Pyramid and appengine's dev_appserver: reload changes

2010-12-10 Thread Rich Churcher
Ubuntu 10.10, Python 2.5 (deadsnakes).

I've been playing with Pyramid using the Google App Engine SDK.  So
far so good, but I'm stumbling over the development cycle a little.
Specifically, in order for the server to pick up changes (for example,
minor template edits) I'm having to kill the dev_appserver.py process
and launch it again.  Seems a little clumsy, is there a way to
convince dev_appserver to reload changed Pyramid files in a similar
fashion to paster serve --reload?

--
Cheers,
Rich

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: Pyramid and appengine's dev_appserver: reload changes

2010-12-10 Thread Chris McDonough
On Fri, 2010-12-10 at 04:12 -0800, Rich Churcher wrote:
 Ubuntu 10.10, Python 2.5 (deadsnakes).
 
 I've been playing with Pyramid using the Google App Engine SDK.  So
 far so good, but I'm stumbling over the development cycle a little.
 Specifically, in order for the server to pick up changes (for example,
 minor template edits) I'm having to kill the dev_appserver.py process
 and launch it again.  Seems a little clumsy, is there a way to
 convince dev_appserver to reload changed Pyramid files in a similar
 fashion to paster serve --reload?

This may help:

http://docs.pylonshq.com/pyramid/dev/narr/templates.html#automatically-reloading-templates

 
 --
 Cheers,
 Rich
 


-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: Pyramid and appengine's dev_appserver: reload changes

2010-12-10 Thread Rich Churcher
On Dec 11, 5:21 am, Chris McDonough chr...@plope.com wrote:
 This may help:

 http://docs.pylonshq.com/pyramid/dev/narr/templates.html%23automatically-reloading-templates

And here I thought I'd read the documentation.  I didn't notice that
setting, but sadly it doesn't seem to have any effect on the appengine
development server.  I suspect it would only work if you were using
paster?  Having that environment variable set seems to make no
difference.

Furthermore, editing views.py or models.py results in the following
error on next page load:

...
  File /usr/lib/python2.5/pkgutil.py, line 186, in find_module
file, filename, etc = imp.find_module(subname, path)
  File /home/basie/work/appengine/divisions/app/lib/python/
appengine_monkey.py, line 66, in find_module
full_py = os.path.join(p, subname + '.py')
AttributeError: 'NoneType' object has no attribute 'path'

--
Cheers,
Rich.

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Re: Pyramid and appengine's dev_appserver: reload changes

2010-12-10 Thread Mike Orr
On Fri, Dec 10, 2010 at 2:01 PM, Rich Churcher rich.churc...@gmail.com wrote:
 On Dec 11, 5:21 am, Chris McDonough chr...@plope.com wrote:
 This may help:

 http://docs.pylonshq.com/pyramid/dev/narr/templates.html%23automatically-reloading-templates

 And here I thought I'd read the documentation.  I didn't notice that
 setting, but sadly it doesn't seem to have any effect on the appengine
 development server.  I suspect it would only work if you were using
 paster?  Having that environment variable set seems to make no
 difference.

I'm not sure at which level template reloading occurs, but it may not
work on the App Engine server, and so it's disabled in the development
server because the dev server is supposed to have the exact behavior
of the real server.

 Furthermore, editing views.py or models.py results in the following
 error on next page load:

 ...
  File /usr/lib/python2.5/pkgutil.py, line 186, in find_module
    file, filename, etc = imp.find_module(subname, path)
  File /home/basie/work/appengine/divisions/app/lib/python/
 appengine_monkey.py, line 66, in find_module
    full_py = os.path.join(p, subname + '.py')
 AttributeError: 'NoneType' object has no attribute 'path'

Always more errors due to App Engine not supporting Python filesystem
functions. They've supposedly fixed App Engine so it works with
Setuptools, and provided stub functions for the common OS operations.
Maybe it works without the monkey now?

-- 
Mike Orr sluggos...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Fancy Validators

2010-12-10 Thread gazza
Hello,

I have written a fancy validator and its task is to verify whether
dates are within a valid a range.
However when it fails as expected I call:

raise formencode.Invalid(msg,field_dict,state,
error_dict=dict(orderid=msg))

This simply renders the message to the browser as expected. Ideally I
want to reissue the page that
posted the date. Is there a way to do this using a fancy validator?

Thanks,
Gazza

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.



Adventures in Pylons - Pyramid: WSGIController.__call__

2010-12-10 Thread Rob Miller

Hi all,

So I've started taking a look at what it would take to port a large 
suite of Pylons 0.9.6 apps to Pyramid.  Most of what needs to happen 
looks pretty straightforward; we'd need to convert all of the routes 
wiring to the new handler / action mechanisms, and make some superficial 
changes to the code within the action methods.  Maybe a bit painstaking 
and repetitive, but not particularly mind-bending.


There's one pattern in use that presents a bigger problem, however. 
These apps have a shared set of controller base classes, from which the 
actual controller implementations within the apps themselves inherit. 
Some of what happens in these controller base classes is just additional 
API stuff, fairly easily converted to a parallel set of handler base 
classes.


The tricky parts, though, are the cases where these controllers have 
overridden the __call__ method to effectively wrap the entire WSGI 
invocation to do such handy things as logging, caching, and error 
handling.  This isn't easy to replicate, because with Pyramid there's no 
way to get control of the outer layers of the request processing cycle 
like there is with Pylons (see 
http://docs.pylonshq.com/pyramid/dev/narr/router.html).


In trying to think this through I've come up w/ a couple of ideas:

- I could write my own set of action decorators that implement the 
desired functionality in addition to marking the wrapped functions as 
exposed actions.  This would essentially be the same thing as stacking 
multiple decorators around each of the functions, except that it avoids 
having to stack multiple decorators around each of the functions.  ;)


- I could override the router itself, to allow me to keep the wrapped 
functionality closer to the WSGI level.  Pyramid doesn't really provide 
any hooks for this, however.  It'd be easy enough to change Pyramid to 
fetch the router by interface rather than by class, making it possible 
to supply an alternate router implementation, but there's a lot of code 
in that __call__ method; I'm not terribly fond of copy/pasting large 
blocks of code only to add a handful of additional lines to the middle 
somewhere.


Does anyone have any other suggestions?  Opinions on the suggestions 
I've made?  Has anybody out there thought about how to handle this 
pattern in a Pyramid upgrade?


Thanks!

-r

--
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.