While I don't have an answer for the question you're asking (and I do
apologize for that, I just don't have it right now), I do have to ask if
you're sure that you're asking the right question.

I ask this because most people who write apps with TG either intend to put
them into a production environment, or for general distribution. In either
of those cases, SQLite is a very bad choice.

In a production environment, you're going to have severe risk of data
corruption.

For distribution, you have little to no guarantee that your user will use
SQLite.

In either case, you're possibly introducing many more problems than you are
solving right now. So, I ask you: Are you certain that the solution you're
asking for will actually solve your problems and not create whole new ones?

On Sun, Feb 20, 2011 at 3:40 PM, sharkus <[email protected]> wrote:

> 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.
>
>


-- 
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/[email protected]

-- 
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.

Reply via email to