Re: computing url for view registered by name

2011-03-01 Thread Michael Merickel
I noticed in your example you aren't specifying a context= or for_= in the view_config, implying you maybe intended to use route_name instead of name with url dispatch. If you are using traversal your application basically assumes a resource tree, and so to get the url you provide a resource objec

Re: Question about virginia

2011-03-01 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/01/2011 05:32 AM, Georges Dubus wrote: > Hi there > > I was looking at the virginia sample application, and I have a few > question : > > - What mechanism protects the application from viewing the /../ dir ? > I know the open method from Filesy

Re: view_config registers twice if module is imported more than once with scan

2011-03-01 Thread Wichert Akkerman
On 2011-3-1 20:01, Chris Withers wrote: Hi All, So, the symptom of this is an exception as follows when the config commits: ConfigurationConflictError: Conflicting configuration actions For: ('view', None, '', None, , None, None, None, 'user', None, False, None, None, None) ('...views.py', 119,

Re: view_config registers twice if module is imported more than once with scan

2011-03-01 Thread Chris Withers
On 01/03/2011 19:26, Victor Fernandez de Alba wrote: @view_config( ) class myViewClass(): ... @view_config( ) class myOtherView(myViewClass): I've workarround it by using more generic meta-classes but it should work, isn't it? I do this too, but I only experienced the problem

Re: view_config registers twice if module is imported more than once with scan

2011-03-01 Thread Victor Fernandez de Alba
Hi, I've experienced this issue as well using classes for rendering views when the class inherits from other class which already have other view declared. For example: @view_config( ) class myViewClass(): ... @view_config( ) class myOtherView(myViewClass): I've workarround it b

view_config registers twice if module is imported more than once with scan

2011-03-01 Thread Chris Withers
Hi All, So, the symptom of this is an exception as follows when the config commits: ConfigurationConflictError: Conflicting configuration actions For: ('view', None, '', None, pyramid.interfaces.IView>, None, None, None, 'user', None, False, None, None, None) ('...views.py', 119, '', 'cl

Re: pyramid_beaker vs beaker wsgi middleware

2011-03-01 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/01/2011 04:02 AM, Andrey Popp wrote: > Hello Tres, > >> FWIW, repoze.who 2.0 explicitly works to enable / ease using the >> machinery where needed in the app by exposing the configured plugins via >> an API (the login and logout views are the o

Re: computing url for view registered by name

2011-03-01 Thread Jean-Philippe
Hi Chris, First off, I believe your views need to be named for this to work. That being said, the following would work from within a view callable: url = request.route_path('history') helpful pages: http://docs.pylonsproject.org/projects/pyramid/1.0/narr/urldispatch.html#generating-route-urls

Question about virginia

2011-03-01 Thread Georges Dubus
Hi there I was looking at the virginia sample application, and I have a few question : - What mechanism protects the application from viewing the /../ dir ? I know the open method from Filesystem check the path before opening a file, but that doesn't explain that when going to the url http://loc

WebTest doesn't like Pyramid NotFound rendering

2011-03-01 Thread Chris Withers
Hi All, I have a view that raises a NotFound if it can't find the model it's trying to render. I have a functional test for this that uses WebTest along the lines of: def test_not_there(self): self.testapp.get('/not_there', status=404) This results in the following barf from WebT

Re: webhelpers.paginate: html entity for symbol_previous|next

2011-03-01 Thread Daniel Holth
Wrap « in webhelpers.html.literal() or ...set # -*- coding: utf-8 -*- in your Python file and just pass the unicode character to the batcher. -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@goog

computing url for view registered by name

2011-03-01 Thread Chris Withers
Hi All, I have two views: @view_config(renderer='templates/index.pt') class IndexView(..): ... @view_config(name='history',renderer='templates/history.pt') class HistoryView(..): ... How should I generate urls to these? cheers, Chris -- Simplistix - Content Management, Batch Processin

Re: am I evil?

2011-03-01 Thread Chris Withers
On 01/03/2011 12:58, Daniel Nouri wrote: Spurred by this discussion, I implemented a simple events system that's akin to Zope3's object events. For a fuller version of this pattern, check out: http://pydispatcher.sourceforge.net/ cheers, Chris -- Simplistix - Content Management, Batch Proce

Re: am I evil?

2011-03-01 Thread Daniel Nouri
Spurred by this discussion, I implemented a simple events system that's akin to Zope3's object events. >From the docs: To subscribe only to insert events of documents, do:: def document_insert_handler(event): print event.object, event.request kotti.events.objectevent_listeners[(kotti

webhelpers.paginate: html entity for symbol_previous|next

2011-03-01 Thread Chris Withers
Hi All, I like to use « and » as my batch links. If I pass these as symbol_previous and symbol_next, they get html quoted. How can I stop that happening? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You rec

pyramid pagination gotcha: depend on WebHelpers, not paginate

2011-03-01 Thread Chris Withers
On 25/02/2011 00:20, Mike Orr wrote: What version of webhelpers should I use? Are there any changes to the query I should make to make it more efficient? Just follow the WebHelpers instructions, and define a URL generator callback to pass. WebHelpers 1.2 is the current version and has been sta

Re: pyramid_beaker vs beaker wsgi middleware

2011-03-01 Thread Andrey Popp
Hello Tres, > FWIW, repoze.who 2.0 explicitly works to enable / ease using the > machinery where needed in the app by exposing the configured plugins via > an API (the login and logout views are the obvious consumers). It also > retainis the flexibility of middleware for enforcing policies. sorr

Re: am I evil?

2011-03-01 Thread Andrey Popp
> The event_manager could be ZCA event API. You could also move event-firing > logic inside subclass of class of some_objects repository: Oh, sorry, I was thought of wrapping repository inside versioning repository proxy, not subclassing. :-) -- You received this message because you are subsc

Re: am I evil?

2011-03-01 Thread Andrey Popp
Another approach is using separate repositories for storing data and revision history, it can be implemented as events, I think Tres Seaver was talking about that in this thread: some_obj = some_objects.get(123) user = request.user # mutate some_obj event = SomeObjectChanged(some_obj, u

Re: am I evil?

2011-03-01 Thread Andrey Popp
Hello, On Feb 27, 2011, at 10:40 PM, Chris Withers wrote: > I'm writing a SQLAlchemy SessionExtension based on this pattern: > > http://www.sqlalchemy.org/trac/browser/examples/versioning/history_meta.py?rev=7253:3ef75b251d06#L171 > > So, in the listener, I want to record the user that made the

Re: am I evil?

2011-03-01 Thread Daniel Nouri
On Tue, Mar 1, 2011 at 8:09 AM, Chris Withers wrote: > On 28/02/2011 18:42, Tres Seaver wrote: >> >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 02/28/2011 12:53 PM, Chris Withers wrote: >>> >>> On 28/02/2011 16:58, Tres Seaver wrote: > > I'm worried that I'm being evil. Am I