Re: FormEncode inadequate?

2010-05-13 Thread Haron Media

Thanks for all your responses. Seems like my worries are justified. So I
guess I'm really better off with a custom solution.



 If you want to see the nice things about formencode and pycerberus,
 you might want to read the first two paragraphs on [1] where I put up
 a bullet point list of pycerberus' strengths.


Thanks, I'll take a look. ;)



Vlad

-- 
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: Paster not shutting down properly because of background threads

2010-05-13 Thread Marius Gedminas
On Wed, May 12, 2010 at 09:25:15AM -0700, Martine wrote:
 I have recently upgraded to Ubuntu 10.04 from 9.10 and paster won't
 shutdown cleanly anymore when I press Ctrl+C. It hangs forever at this
 step:
 
 $ paster serve production.ini
 Starting server in PID 9424.
 serving on 0.0.0.0:8000 view at http://127.0.0.1:8000
 ^C2010-05-12 10:35:29 INFO  [paste.httpserver.ThreadPool] Shutting
 down threadpool
 2010-05-12 10:35:29 INFO  [paste.httpserver.ThreadPool] All workers
 stopped
 
 It turns out that it's hanging because of some worker threads.

Threads that you started manually, right?

 I have tried creating a new project for testing with code from this
 webpage, and the problem still happens:
 http://chrismoos.com/2009/03/04/pylons-worker-threads/

It creates a non-daemon thread that runs forever.  A Python process
doesn't exit until all non-daemon threads exit.

Incidentally, I do _not_ recommend changing your worker thread into a
daemon thread; those have their own share of serious issues (could be
terminated at any time, e.g. in the middle of a job, or could be running
during interpreter shut down where all the global namespaces are
cleared, resulting in really weird exceptions).

The best solution is to trap the interpreter shutdown and explicitly
signal your worker thread to quit.  Something like

QUIT = object() # unique marker object
...
def run(self):
while True:
msg = worker_q.get()
if msg is QUIT:
break
...

I don't know how to reliably trap the server shutdown, though.  It
depends on the particular server you're using to serve your WSGI app, I
suppose.  (For the same reason I'm also not sure it's safe to spawn
threads from load_environment.)

 I didn't have any problems before the upgrade to 10.04 so this is
 pretty strange. Has anyone run into a similar problem?

I'm not sure what could've changed with the Ubuntu 9.04 - 10.04
upgrade; if you're using the default Python version (2.6 on both), I'd
expect the same behaviour on both: i.e. process not exiting until all
threads stop.

Marius Gedminas
-- 
Writing like a l33t script kiddie hax0r is the absolute kiss of death and
guarantees you will receive nothing but stony silence (or, at best, a heaping
helping of scorn and sarcasm) in return.
-- ESR (http://www.tuxedo.org/~esr/faqs/smart-questions.html)


signature.asc
Description: Digital signature


WebTest 1.2.1 issue with cookie

2010-05-13 Thread Eric Lemoine
Hello

My app's functional tests fail with WebTest 1.2.1, because auth
cookies aren't set in the requests. I use repoze.who and what. Someone
reported the issue on stackoverflow, see
http://stackoverflow.com/questions/2731907/unit-testing-authorization-in-a-pylons-app-fails-cookies-arent-been-correctly-s.
Is it a known problem? Is there a workaround (other than downgrading
to WebTest 1.2?

Thanks for any response,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.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.



Re: WebTest 1.2.1 issue with cookie

2010-05-13 Thread Eric Lemoine
On Thu, May 13, 2010 at 8:03 PM, Eric Lemoine
eric.lemo...@camptocamp.com wrote:
 Hello

 My app's functional tests fail with WebTest 1.2.1, because auth
 cookies aren't set in the requests. I use repoze.who and what. Someone
 reported the issue on stackoverflow, see
 http://stackoverflow.com/questions/2731907/unit-testing-authorization-in-a-pylons-app-fails-cookies-arent-been-correctly-s.
 Is it a known problem? Is there a workaround (other than downgrading
 to WebTest 1.2?

I just tried WebTest trunk, and I have the same issue.

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.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.



embedding pylons in apache problem

2010-05-13 Thread James McManus
I'm trying to embed pylons in my apache server, following the instructions
in the Pylons Book. When I start my server I do not get an error.  The
following egg is created in egg-cache:

egg-cache/simplejson-2.0.9-py2.5-linux-x86_64.egg-tmp/

However, when I access the web site, I get the following error:

[Thu May 13 20:02:32 2010] [error] [client 71.120.222.68] Error - type
'exceptions.OSError': [Errno 13] Permission denied: '/html'

I set the permission on /html, which is my application directory, to the
same setting I have for egg-cache, so I should be able to write to it, since
I was able to write to egg-cache.

What is pylons writing to my applications directory, and do I need to have
another setting to write to that directory?

Thanks
Jim

-- 
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: embedding pylons in apache problem

2010-05-13 Thread Graham Dumpleton


On May 14, 10:16 am, James McManus jmpmcma...@gmail.com wrote:
 I'm trying to embed pylons in my apache server, following the instructions
 in the Pylons Book. When I start my server I do not get an error.  The
 following egg is created in egg-cache:

 egg-cache/simplejson-2.0.9-py2.5-linux-x86_64.egg-tmp/

 However, when I access the web site, I get the following error:

 [Thu May 13 20:02:32 2010] [error] [client 71.120.222.68] Error - type
 'exceptions.OSError': [Errno 13] Permission denied: '/html'

 I set the permission on /html, which is my application directory, to the
 same setting I have for egg-cache, so I should be able to write to it, since
 I was able to write to egg-cache.

 What is pylons writing to my applications directory, and do I need to have
 another setting to write to that directory?

You cant use relative pathnames, use absolute paths instead. See:

  
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Application_Working_Directory

Graham

-- 
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: Pystache

2010-05-13 Thread Jan Koprowski
All is in documentation:
http://pylonsbook.com/en/1.1/using-view-templates.html#behind-the-scenes

On May 13, 12:35 am, Yang Zhang yanghates...@gmail.com wrote:
 Has anybody integrated the Pystache (mustache) templating engine into
 Pylons? How hard is it to integrate new templating languages like this
 one?
 --
 Yang Zhanghttp://yz.mit.edu/

 --
 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 
 athttp://groups.google.com/group/pylons-discuss?hl=en.

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