Re: Flickr tutorial under 0.9.7?

2008-12-17 Thread Alex Marandon

2008/12/16 Mike Orr sluggos...@gmail.com:
 By the way, Pylons homepage says: AJAX: Rails-style WebHelpers based
 on Prototype, or Mochikit, jQuery, Dojo, Ext  more. I'm wondering
 what that means.

 I've been curious about that too, since the JavaScript helpers are
 implemented with Prototype. I think the intent, though, is just to
 indicate that it's easy to use any of those libraries with Pylons or
 to create your own helpers based on those libs.

 It indicates the website is out of date. :)

OK it used to be true for Prototype, but what about the other ones?
I'm a bit worried about newcomers getting exciting at reading this and
then finding out that there isn't really such a thing in Pylons.

 Is it going to be possible to keep the current Rails-style WebHelpers
 while using newer versions of Pylons or will we definitely have to
 port our code?

 You'll have to make some adjustments at least.  The easiest is to copy
 the old helper modules into your application and adjust the imports in
 helpers.py.  You can do that any time in the next several months.

 Alternatively, you could hack Pylons' egg-info to not require the
 newer version, but that would be overwritten if you reinstall or
 upgrade Pylons.

Thank you for the hint, copying the old module seems to be simpler indeed.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@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: Flickr tutorial under 0.9.7?

2008-12-16 Thread Alex Marandon

2008/12/15 Mike Orr sluggos...@gmail.com:
 You can add the Javascripts app to middleware.py and it will probably
 work, but that part of WebHelpers is deprecated and will be gone by
 Pylons 0.9.8.

Is it going to be possible to keep the current Rails-style WebHelpers
while using newer versions of Pylons or will we definitely have to
port our code?

By the way, Pylons homepage says: AJAX: Rails-style WebHelpers based
on Prototype, or Mochikit, jQuery, Dojo, Ext  more. I'm wondering
what that means.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@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: Django or Pylons - comparison details

2008-12-08 Thread Alex Marandon

2008/12/6 zunzun [EMAIL PROTECTED]:
 Seems like I should use Django?  Or should it be Pylons instead?

Here is the advice of an average programmer with no emotional
involvement in any of these projects.

I think it depends on your background. The Pylons ecosystem is very
powerful but it's quite complex and not really suitable for beginners.
If it's going to be the first web framework you use, you should
probably stick with Django or even better Rails. If you're a seasoned
web developer used to get acquainted quickly with new APIs and want a
maximum of flexibility, then Pylons is for you. Don't let the size of
the community fool you, when it comes to technical advice quality
matters more than quantity.

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



Re: books

2008-12-07 Thread Alex Marandon

2008/12/7 jose [EMAIL PROTECTED]:

 I'm thinking of pre-ordering the pylons book, and Amazon gives you the
 option to get the sqlalchemy book at the same time.  Has anyone red
 the book? is it good? is is fairly recent or better yet how out of
 date is it?

I've read it a couple of months ago. It's pretty good but it refers to
SQLAlchemy
0.4.x so you'll have to adapt some of the content if you want to use
the upcoming
0.5 version. The migration guide is at
http://www.sqlalchemy.org/trac/wiki/05Migration

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



Pylons and Python 2.6 (Was: Re: go-pylons.py broken on Python 2.6 in Windows?)

2008-11-12 Thread Alex Marandon

2008/11/11 Ben Bangert [EMAIL PROTECTED]:
 On Nov 11, 2008, at 7:38 AM, Alex Marandon wrote:

 As far as I know, Pylons doesn't support Python 2.6, no matter what
 operating system you're on. At least that's how it was last time I
 checked.

 Pylons does run on Python 2.6, and we have buildbots that run to ensure the
 tests all pass on Python 2.6. RC3 is the first release to use all the new
 builds for it, though a few bugs crept in so RC4 will be out shortly.

Oh that is good news! I apologize for spreading erroneous information.
I can see that the problem which was preventing nose to run on Python
2.6 has now been fixed. I should have checked before posting.

By the way is the production version of Pylons also know to be compatible?
How about the libraries often used with Pylons (Routes, Mako,
SQLAlchemy, Elixir, etc.)?
Has anyone here started to migrate their production Pylons apps to Python 2.6?

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



Re: go-pylons.py broken on Python 2.6 in Windows?

2008-11-11 Thread Alex Marandon

2008/11/11 Eric Ongerth [EMAIL PROTECTED]:
 In any case, I'm sailing along just fine after setting up Python 2.6
 and then virtualenv 1.3.  Still, I thought it noteworthy for the
 careful reviewing of 0.9.7rc3 before it goes final, that the current
 go-pylons script linked near the top of the how-to page appears to be
 a no-go on Windows under Python 2.6.

As far as I know, Pylons doesn't support Python 2.6, no matter what
operating system you're on. At least that's how it was last time I
checked.

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



Limiting test coverage to the application code

2008-09-10 Thread Alex Marandon

Hello,

I'm trying to get test coverage statistics of a Pylons app using nose
and its cover plugin.
I've included a cover-package option in my setup.cfg, but when I run
'setup.py nosetests' followed by 'coverage -r', I get stats for all
the imported modules.

Any idea of what I'm missing?

Thanks,
Alex

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



Re: The Pylons Book

2008-07-14 Thread Alex Marandon

2008/7/11 [EMAIL PROTECTED] [EMAIL PROTECTED]:
 I'm very pleased to announce that the first draft of the Pylons book is now
 complete.

I've seen that the book is available for pre-ordering from Amazon and
I was wondering if some of the money spent on buying the book would go
to the Pylons project.

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



Re: REST, filtering, and related resources

2008-06-20 Thread Alex Marandon

2008/6/20 Sean Davis [EMAIL PROTECTED]:
 Therefore, I was planning on a web/web-
 services approach using REST approaches.  It seems that dealing with
 single collections is pretty straightforward, but I have a couple of
 questions:

 1)  What is the standard for filtering a single collection
 (specifying some fields and some match criteria like begins_with,
 etc.)?

I guess appending a query string to your resource collection path
would be OK, wouldn't it?
(ie: /authors/12/books?begin_with=foo)

 2)  How does one deal with relationships between collections?  It
 looks like nested urls like:

 http://example.com/author/12/books

 are the correct way to handle this, but could someone enlighten me on
 whether or not there is a standard?

Routes has support for nested collections:
http://routes.groovie.org/class-routes.base.Mapper.html#resource Look
at the parent_resource argument.
It seems to suggest that the standard would then be /authors/12/books.

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



Re: Calling a WSGI application from an action

2008-06-03 Thread Alex Marandon

2008/6/2 Ian Bicking [EMAIL PROTECTED]:
 You need code that takes req.POST and turns it into the serialized body,
 so that the WSGI app you are calling can reconstruct that body.

 I understand that Pylons parses the body of the POST request and turns
 into a Python data structure. In particular, any uploaded file gets
 turned into a cgi.FieldStorage. What I need to do is convert it back
 to its serialized version. Am I correct so far?

 Then where should I set the serialized version so that it can be used
 by oher WSGI apps? It seems that request.POST can't be assigned a new
 value.

 You'd put a new file-like object into wsgi.input, like:

 from cStringIO import StringIO
 environ['wsgi.input'] = StringIO(serialized_body)

Great, I managed to make it working. I'll try to get my head around
webob and add it there.
Thanks a lot.

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



Re: Calling a WSGI application from an action

2008-06-02 Thread Alex Marandon

2008/5/30 Ian Bicking [EMAIL PROTECTED]:
 I'm trying to apply the recipe from
 http://wiki.pylonshq.com/display/pylonsdocs/Web+Server+Gateway+Interface+Support#running-a-wsgi-application-from-within-a-controller

 Unfortunately it works only for the file management features, not for
 the upload. After digging into FCKeditor's Python code I figured out
 that the WSGI app doesn't get all the data it needs from from the WSGI
 environment. I dumped the WSGI environment when running the app under
 mod_wsgi directly and within Pylons and there happen to be a lot of
 differences between the two. I'm wondering if there would be a way to
 get access to the original WSGI environment, before it gets modified
 by Pylons, so that it would be compatible with what a regular WSGI
 application expect.

 WebOb makes this easier, with:

 resp = req.get_response(fckeditor_wsgi)

 If you aren't using a very new version of Pylons, you can make a webob
 request with webob.Request(request.environ)

 However, there is a problem that the POST body can be eaten up.  WebOb
 specifically tries to reconstruct it, but not for file uploads (simply
 because I didn't get around to it, because it's harder to construct than
 a simple POST form).  And maybe what you are encountering is this same
 issue.

Hi Ian, thanks a lot for answering my message.

One thing I don't understand, is why the POST body gets
deconstructed in the first place. I don't have a deep understanding
of WSGI yet, but I thought one of its advantages was to allow
developers to build arbitrary chains of middlewares and applications
that are not aware of each others. So how come Pylons is modifying
the POST body in such a way that it can't be used by subsequent WSGI
component in the chain?

 This recipe roughly describes what a file upload looks like:
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306

 You need code that takes req.POST and turns it into the serialized body,
 so that the WSGI app you are calling can reconstruct that body.

I understand that Pylons parses the body of the POST request and turns
into a Python data structure. In particular, any uploaded file gets
turned into a cgi.FieldStorage. What I need to do is convert it back
to its serialized version. Am I correct so far?

Then where should I set the serialized version so that it can be used
by oher WSGI apps? It seems that request.POST can't be assigned a new
value.

 I'd be
 happy for webob to be able to do this, if you are inclined to add it
 there -- the code is in webob.FakeCGIBody._get_body(), and the instance
 would have to be aware of the Content-Type of the upload, and if it's
 multipart/form-data then it would have to reconstruct the body
 differently, in line with what that recipe does.

I'd be happy to add it once I get a sufficient understanding of what
I'm doing. I should probably do it outside of WebOb to start with and
then I'll try to integrate it into WebOb so that it can be easily
reused.

Regards,
Alex

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



Re: advice with configuration/scaling a live Pylons app.

2008-05-30 Thread Alex Marandon

2008/5/30 Graham Dumpleton [EMAIL PROTECTED]:
 class FooController(BaseController):

 def bla(self):
 return 'Hello World! %s' % time.time()

 def slow_bla(self):
 time.sleep(10)
 return 'Hello slow World!'

 With something like that, manual testing works just fine (ie: I'm able
 to hit the action bla as many times as I want while the action
 slow_bla is still serving).

 When testing with ab though, I do get failed requests, but I actually
 get even more failed requests with Apache/mod_wsgi.

 What options are you using to 'ab'?

-n 1000 -c 3

 The 'ab' program can give a perception of errors, normally manifesting
 as lots of exceptions on server side in log file, if you use
 concurrent requests. This occurs because it only stops when it
 receives responses for the number of requests you tell it to make.
 With a request handler that takes a long time, because of a sleep()
 call, the 'ab' program can actually issue more requests than you tell
 it to. When it does receive responses for the number you told it, it
 will simply shutdown the connections for all the additional requests
 it made which it hasn't yet received a response. The result of this is
 that on the server side it will see a bunch of closed connections
 causing failures to be able to write the responses for the additional
 requests.

Note that I didn't test against the action that does a sleep. I'm a
bit confused by your explanation. Does it mean that the errors should
show up in the logs on the server side? I was only looking at ab's
output.

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



Calling a WSGI application from an action

2008-05-30 Thread Alex Marandon

Hello,

I'm trying to integrate FCKeditor's file management and upload
features into a Pylons app. FCKeditor ships with a WSGI application to
handle the server side of these features. I tried to run that
application under mod_wsgi and it works fine. Now I'd like to
integrate that within my Pylons app to take advantage of my
authentication mechanism, so that only registered users can upload
files.

I'm trying to apply the recipe from
http://wiki.pylonshq.com/display/pylonsdocs/Web+Server+Gateway+Interface+Support#running-a-wsgi-application-from-within-a-controller

Unfortunately it works only for the file management features, not for
the upload. After digging into FCKeditor's Python code I figured out
that the WSGI app doesn't get all the data it needs from from the WSGI
environment. I dumped the WSGI environment when running the app under
mod_wsgi directly and within Pylons and there happen to be a lot of
differences between the two. I'm wondering if there would be a way to
get access to the original WSGI environment, before it gets modified
by Pylons, so that it would be compatible with what a regular WSGI
application expect.

Another minor issue I've got is that the HTTP Content-Type header
(text/xml in this case) is not sent properly when calling the WSGI app
from Pylons. That one is not very critical as I can set it with the
controller action which calls the WSGI app.

Any help would be much appreciated, as I'm beginning to pull my hair on this.
Thanks,
Alex

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



Re: advice with configuration/scaling a live Pylons app.

2008-05-29 Thread Alex Marandon

2008/5/28 SamDonaldson [EMAIL PROTECTED]:
 Running ab benchmark tests revealed many requests were failing.
 Should I be starting MORE Paster processes to handle the load?  Is
 this the right thing to do, or is the Paster (SCGI) process itself
 multi-threaded to handle such synchronous requests.  Say the Paster
 process is doing some I/O (SQL query through sqlalchemy), would that
 process block and would other requests wait, or would they get
 serviced?

Hi Sam,

According to 
http://wiki.pylonshq.com/display/pylonscookbook/Pylons+Execution+Analysis+0.9.6
paster is multithreaded. It should be easy to test. Hit a controller
action that sleeps for 10 seconds and see if you can still make
requests to other actions. I actually need to test for myself as soon
as I get to work. As for why you get failed requests, I don't know.

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



Re: advice with configuration/scaling a live Pylons app.

2008-05-29 Thread Alex Marandon

2008/5/29 Alex Marandon [EMAIL PROTECTED]:
 2008/5/28 SamDonaldson [EMAIL PROTECTED]:
 Running ab benchmark tests revealed many requests were failing.
 Should I be starting MORE Paster processes to handle the load?  Is
 this the right thing to do, or is the Paster (SCGI) process itself
 multi-threaded to handle such synchronous requests.  Say the Paster
 process is doing some I/O (SQL query through sqlalchemy), would that
 process block and would other requests wait, or would they get
 serviced?

 Hi Sam,

 According to 
 http://wiki.pylonshq.com/display/pylonscookbook/Pylons+Execution+Analysis+0.9.6
 paster is multithreaded. It should be easy to test. Hit a controller
 action that sleeps for 10 seconds and see if you can still make
 requests to other actions. I actually need to test for myself as soon
 as I get to work. As for why you get failed requests, I don't know.


class FooController(BaseController):

def bla(self):
return 'Hello World! %s' % time.time()

def slow_bla(self):
time.sleep(10)
return 'Hello slow World!'

With something like that, manual testing works just fine (ie: I'm able
to hit the action bla as many times as I want while the action
slow_bla is still serving).

When testing with ab though, I do get failed requests, but I actually
get even more failed requests with Apache/mod_wsgi.

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