Re: How to access Paster/ini configuration in models/test scripts

2011-02-01 Thread Daniel Holth
You could say pyramid.threadlocal.get_current_registry().settings http://docs.pylonsproject.org/projects/pyramid/dev/api/threadlocal.html#pyramid.threadlocal.get_current_registry Whether you /should/ is up to you. Daniel -- You received this message because you are subscribed to the Google Gro

Re: How to access Paster/ini configuration in models/test scripts

2011-02-01 Thread Atsushi Odagiri
hi Ryan Maybe, you want that pyramid.threadlocal.get_current_registry().setting 2011/02/02 10:34 "Ryan McKillen" : > I should have specified that I'm using Pyramid. > > > On Tue, Feb 1, 2011 at 5:03 PM, Wyatt Baldwin > wrote: > >> On Tuesday, February 1, 2011 4:03:13 PM UTC-8, Ryan wrote: >>> >>>

Re: How to access Paster/ini configuration in models/test scripts

2011-02-01 Thread Ryan McKillen
I should have specified that I'm using Pyramid. On Tue, Feb 1, 2011 at 5:03 PM, Wyatt Baldwin wrote: > On Tuesday, February 1, 2011 4:03:13 PM UTC-8, Ryan wrote: >> >> I'm aware that request.environ['paste.config'] will return configuration >> settings from whichever .ini is being utilized, in a

Re: How to access Paster/ini configuration in models/test scripts

2011-02-01 Thread Wyatt Baldwin
On Tuesday, February 1, 2011 4:03:13 PM UTC-8, Ryan wrote: > > I'm aware that request.environ['paste.config'] will return configuration > settings from whichever .ini is being utilized, in a view. How can I access > the Paster configuration from a model or test script? I would recommend that yo

Re: Serving mobile templates

2011-02-01 Thread Chris McDonough
FTR, in Pyramid, this would be spelled something like: def mobile_user_agent(info, request): if request.user_agent in ['list', 'of', 'mobile', 'agents']: return True return False And then you would associate that predicate with views, ala: @view_config(custom_predicates=(mobile_u

Re: Serving mobile templates

2011-02-01 Thread Mike Orr
On Thu, Jan 27, 2011 at 1:58 PM, Brian O'Connor wrote: > What's the current best practice for serving mobile templates?  The ideal > situation for me _right now_ would be if I detect a user on a mobile client > (either by url or USER_AGENT detection), the render() function would first > look in a

How to access Paster/ini configuration in models/test scripts

2011-02-01 Thread Ryan
I'm aware that request.environ['paste.config'] will return configuration settings from whichever .ini is being utilized, in a view. How can I access the Paster configuration from a model or test script? -- You received this message because you are subscribed to the Google Groups "pylons-discus

Re: make all url calls qualified=True

2011-02-01 Thread webjunkie
Hi Wyatt, I actually wanted to modify the url function itself since I had a lot of url() calls all over my code. But I opted to modify each one instead. Thanks for the help. On Jan 31, 7:57 pm, Wyatt Baldwin wrote: > You could add a `url` function to your helpers module that wraps > `pylons.url

how to exclude directories when creating an egg

2011-02-01 Thread webjunkie
I've been trying to build a distribution egg and when I do it includes everything on my app directory. I have a media folder which contains images that belong to db records and I would like to exclude that directory. I have tried to do this by including this line in the manifest.ini file exclude a

Re: sqlalchemy without scoped_session

2011-02-01 Thread Daniel Holth
I do have my own WSGI transaction manager. It is 44 lines long. It operates at the WSGI layer so it puts the per-request session in the WSGI environ. It probably issues COMMIT more often than necessary. It exists to avoid an external dependency in case you would rather use a different transacti

Re: sqlalchemy without scoped_session

2011-02-01 Thread Michael Merickel
s = Session.object_session(self) without model code should work with the caveat that it won't if the object isn't part of a session yet. Also wanted to point out DanielHolth's implementation of this inside of stucco_auth. He stores the session in the environ, sharing it with a custom transaction m

Re: sqlalchemy without scoped_session

2011-02-01 Thread Chris McDonough
On Mon, 2011-01-31 at 21:12 -0800, Michael Merickel wrote: > I wanted to expand on the pyramid_cookbook entry (https://github.com/ > Pylons/pyramid_cookbook/blob/master/sqla.rst) for using sqlalchemy > without the scoped_session. > > So I created a gist that demonstrates more in-depth how it can b