Hi,
I'm struggling to add a custom collation to my turbogears 2 project.
I've added the following code to the model/__init__.py file and
everything works great from the shell.
----
def init_model(engine):
"""Call me before using any of the tables or classes in the
model."""
from project.lib.natsort import natcasecmp
engine.raw_connection().create_collation('natsort', natcasecmp)
...
----
However, when actually testing a query from the site I get an
"OperationalError: (OperationalError) no such collation sequence". I
can SOMETIMES get things to work if I add something like this to my
root controller method (perhaps 1 out of 5 times):
----
from project.lib.natsort import natcasecmp
from tg.configuration import config
engine = config['pylons.app_globals'].sa_engine
engine.raw_connection().create_collation('natsort', natcasecmp)
----
I'm assuming this is because TG is tearing up and down the session
(all the way to the engine) for each response.
So, where is the appropriate place to do the raw_connection call?
Thanks in advance,
Marcus
--
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.