I'm trying to migrate from SQLObject to SQLAlchemy / Elixir and I'm
running into problem implementing SQLObject's _get_ and _set_
functions. Here's the code in question:
class Video(elixir.Entity):
def _get_youtube_id(self):
return self.uri.split('/')[-1]
elixir.has_property('youtube_id',_get_youtube_id)
In SQLObject the getter works fine, but now when I try to run it with
Elixir I get this error:
File "./start-bcstudio.py", line 15, in <module>
start()
File "/Users/balmond/Documents/bcstudio3/bcstudio/commands.py", line
109, in start
from bcstudio.controllers import Root
File "/Users/balmond/Documents/bcstudio3/bcstudio/controllers.py",
line 17, in <module>
from widgets import *
File "/Users/balmond/Documents/bcstudio3/bcstudio/widgets.py", line
5, in <module>
import model
File "/Users/balmond/Documents/bcstudio3/bcstudio/model.py", line
603, in <module>
elixir.setup_all()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/PIL/__init__.py", line 145, in setup_all
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Elixir-0.6.1-py2.5.egg/elixir/entity.py", line
816, in setup_entities
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Elixir-0.6.1-py2.5.egg/elixir/entity.py", line
421, in setup_properties
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Elixir-0.6.1-py2.5.egg/elixir/entity.py", line
433, in call_builders
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/Elixir-0.6.1-py2.5.egg/elixir/properties.py",
line 162, in create_properties
File "/Users/balmond/Documents/bcstudio3/bcstudio/model.py", line
168, in _get_youtube_id
return self.uri.split('/')[-1]
AttributeError: 'Column' object has no attribute 'split'
The problem seems to be that when Elixir sets up the column properties
it hasn't defined the object's attributes yet, so the 'uri' property
is treated as a column reference rather than a Unicode string. Is
there any way around this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---