Re: [Sqlalchemy-tickets] [sqlalchemy] #2338: Registration of class to declarative base with module
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2011-12-01 17:29:01
|
#2338: Registration of class to declarative base with module name
----------------------------------------------------+-----------------------
Reporter: guest | Owner: chrisw
Type: enhancement | Status: new
Priority: medium | Milestone: 0.7.5
Component: declarative | Severity: major - 1-3 hours
Keywords: classnames, relation, declarative base | Status_field: in queue
----------------------------------------------------+-----------------------
Changes (by zzzeek):
* owner: zzzeek => chrisw
* status_field: awaiting triage => in queue
* component: (none) => declarative
* severity: no triage selected yet => major - 1-3 hours
* milestone: => 0.7.5
Comment:
I like this though I wonder about namespace collisions. We use
eval(code) with a dict passed to locals that will look into the named
registry when a key is otherwise missing. So a class that has
"path.to.Class" would need to put tokens for "path" in the registry, as
well as "path" would need to be either the actual "path" module, or some
further namespaced object that then has "to" on it. The presence of many
new names, i.e. for every base module, in the registry might produce other
problems...or maybe not.
in any case the system where this happens starts at
http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/ext/declarative.py#L1299,
I guess we'd add a new "class _GetModule" to handle this new level of
lookup.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2338#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|