Simple Jquery AJAX question

2011-06-16 Thread AwaisMuzaffar
1- In my pyramid package directory, if I create a file called
somefunction.py and I want to call this function using $.post, what
URL would I specify to call this function.

and:

2- And if I have a view function called aview created in views.py, can
I call this function by simply referring the $.post URL as /aview/

(script files reside in the static folder)

Thanks.

-- 
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: Simple Jquery AJAX question

2011-06-16 Thread Robert Jackiewicz
Hi AwaisMuzaffar,

1. To be able to call a python function via an ajax call you will have to make 
the function in your python module a callable view and then call the url that 
is assigned to the view in your js script.

2.  As for calling a view in $.post, are you using traversal or url_dispatch?  
Using either system would cause the urls to be slightly different.  The 
simplest route to take is using url dispatch since it would allow you to create 
a simple url like /aview/.

If you have any other questions please let me know.

Cheers,

RJ

On 2011-06-16, at 8:18 AM, AwaisMuzaffar wrote:

 1- In my pyramid package directory, if I create a file called
 somefunction.py and I want to call this function using $.post, what
 URL would I specify to call this function.
 
 and:
 
 2- And if I have a view function called aview created in views.py, can
 I call this function by simply referring the $.post URL as /aview/
 
 (script files reside in the static folder)
 
 Thanks.
 
 -- 
 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.
 

-- 
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: Simple Jquery AJAX question

2011-06-16 Thread AwaisMuzaffar
Thank you for the reply.

I am using url_dispatch.

I have done as follows:

In the init.py: I have added:

config.add_route('ajax', '/ajax/', view='testproject.views.ajax')

In the views.py:

def ajax(request):
string = 'hello world'
return Response(string)

and my jquery code:

$(a#button).click(function(){
$.post(/ajax/, {}, function(data) {
$(div.data_container).html(data);
}, text);

});

Okay, so this works, but am I setting up the view and add_route
correctly. Is this how it is suppose to be done?

Thanks.
Awais,


On Jun 16, 2:21 pm, Robert Jackiewicz r...@jackiewicz.ca wrote:
 Hi AwaisMuzaffar,

 1. To be able to call a python function via an ajax call you will have to 
 make the function in your python module a callable view and then call the url 
 that is assigned to the view in your js script.

 2.  As for calling a view in $.post, are you using traversal or url_dispatch? 
  Using either system would cause the urls to be slightly different.  The 
 simplest route to take is using url dispatch since it would allow you to 
 create a simple url like /aview/.

 If you have any other questions please let me know.

 Cheers,

 RJ

 On 2011-06-16, at 8:18 AM, AwaisMuzaffar wrote:







  1- In my pyramid package directory, if I create a file called
  somefunction.py and I want to call this function using $.post, what
  URL would I specify to call this function.

  and:

  2- And if I have a view function called aview created in views.py, can
  I call this function by simply referring the $.post URL as /aview/

  (script files reside in the static folder)

  Thanks.

  --
  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 
  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-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: Simple Jquery AJAX question

2011-06-16 Thread Michael Merickel
On Thu, Jun 16, 2011 at 10:03 AM, AwaisMuzaffar awais1...@googlemail.comwrote:

config.add_route('ajax', '/ajax/', view='testproject.views.ajax')

def ajax(request):
string = 'hello world'
return Response(string)


This is fine, but there are 2 enhancements you may want to use in your
Pyramid code.

First, if you want to expand your interface to be more restful in the
future, you may want to separate your config using predicates to match POST
requests to certain views and GET requests to other views. The other thing
is that you can utilize Pyramid's renderers to avoid having to return a full
Response object yourself. As an example, set the renderer to 'json' (or if
you do it in add_route then it's the view_renderer).

config.add_route('ajax', '/ajax')
config.add_view(route_name='ajax', view='testproject.views.ajax',
request_method='POST', renderer='json')

From your view code you can then:

return 'hello world'

and it will be json serialized for you.

-- 

Michael

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



sqlalchemy version in pylons 1.0

2011-06-16 Thread Grigoriy Tretyakov
Hello!

What problem can I have if I will use sqlalchemy version 0.7 with pylons
1.0? Pylons 1.0 uses sqlalchemy version 0.5 by default.

Thanks!

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



File Upload

2011-06-16 Thread Jason
How are file uploads done in Pyramid? 

I have tried to access the file from request.POST['fileupload'] and 
request.params['fileupload'] using this html form:

form action=/upload target=fileupload-frame method=POST 
enctype=multipart/form-data
input type=file id=fileupload name=fileupload
/form

I have tried printing out all the keys in the request, but I cannot find the 
file anywhere. 

Thanks,

Jason

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/LFCbnyZ05csJ.
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.



Pyramid with SQLAlchemy (Non-Gobal session)

2011-06-16 Thread Liju
The documentation says 'It’s sometimes advantageous to not use
SQLAlchemy’s thread-scoped sessions'. Thread-scoped as I understand is
done using scoped_session(), which will associate an SQLAlchemy
session for currently running thread.

WIth my experience from J2EE I understand that each request-response
is a separate thread, and assume thats the same for Pyramid ? If this
is true, whats the benefit of associating a new session in a custom
request object as in the documentation ?

http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/sqla.html#using-a-non-global-session

I dont see a difference. Can someone please explain the difference ?
and which option to use when (with an example).

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



How can I specify the log file for Pyramid ?

2011-06-16 Thread ghosert
I don't see anyway in documentation mentioned this, anyone can post a
url will be helpful.

And maybe add this part to narrative documentation will be useful for
the fresh man.

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



How can I specify the log file for Pyramid ?

2011-06-16 Thread Zhang Jiawei
I don't see anyway in documentation mentioned this, anyone can post a url
will be helpful.

And maybe add this part to narrative documentation will be useful for the
fresh man.

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



Create social networks easily using Redis and Pylons

2011-06-16 Thread Vivek Narayanan
Its really simple to create a scalable social network using Redis, to
demonstrate this I wrote a small library called resn in python that
can provide out of the box support for friends, news feed, asymmetric
connections (like Twitter) and authentication. It uses the redis-py
library by Andy McCurdy and Amir Salihefendic's redis_wrap.

It can be used along with any python web framework including django,
flask, pylons etc .This library can be used by app developers who need
to create mini social networks and can be found at 
https://github.com/vivekn/resn/

Hope this helps,
Vivek Narayanan

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



Benchmark of paster

2011-06-16 Thread Liju
Has someone done a benchmark for paster server ? As per the
documentation to deploy pyramid using ngnix in the mix (for load
balancing etc) paster is used. I have also seen in this and other
forums that folks use this architecture in production. So it will be
good to know how paster perform  how stable it is.

-- 
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: File Upload

2011-06-16 Thread Jason
It was a problem with my form (being submitted by jquery)

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/1bEbkNjqa88J.
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: File Upload

2011-06-16 Thread Chris McDonough
On Thu, 2011-06-16 at 10:54 -0700, Jason wrote:
 It was a problem with my form (being submitted by jquery)

For the record, here's a short tutorial describing file uploads and
Pyramid:

http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/files.html


-- 
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: How can I specify the log file for Pyramid ?

2011-06-16 Thread Chris McDonough
On Thu, 2011-06-16 at 09:06 +0800, Zhang Jiawei wrote:
 I don't see anyway in documentation mentioned this, anyone can post a
 url will be helpful.
 
 And maybe add this part to narrative documentation will be useful for
 the fresh man.

http://docs.pylonsproject.org/projects/pyramid/1.0/narr/project.html#the-myproject-project
 shows the default configuration file.  The stuff under begin logging 
configuration is the logging configuration.  These is the standard Python 
logging module .ini configuration settings, documented at e.g. 
http://docs.python.org/release/2.5.2/lib/logging-config-fileformat.html .

- C


-- 
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: Benchmark of paster

2011-06-16 Thread Chris McDonough
paster is a command, not a server.  Depending on the content of
the .ini file used by paster serve, a type of server is used.  The
default Pyramid .ini file uses the paste.httpserver server (which
despite being named paste has really nothing to do with paster).

See http://nichol.as/benchmark-of-python-web-servers for some
benchmarks.

On Wed, 2011-06-15 at 22:43 -0700, Liju wrote:
 Has someone done a benchmark for paster server ? As per the
 documentation to deploy pyramid using ngnix in the mix (for load
 balancing etc) paster is used. I have also seen in this and other
 forums that folks use this architecture in production. So it will be
 good to know how paster perform  how stable it is.
 


-- 
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: Pyramid with SQLAlchemy (Non-Gobal session)

2011-06-16 Thread Chris McDonough
On Wed, 2011-06-15 at 22:38 -0700, Liju wrote:
 The documentation says 'It’s sometimes advantageous to not use
 SQLAlchemy’s thread-scoped sessions'. Thread-scoped as I understand is
 done using scoped_session(), which will associate an SQLAlchemy
 session for currently running thread.
 
 WIth my experience from J2EE I understand that each request-response
 is a separate thread, and assume thats the same for Pyramid ? If this
 is true, whats the benefit of associating a new session in a custom
 request object as in the documentation ?
 
 http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/sqla.html#using-a-non-global-session
 
 I dont see a difference. Can someone please explain the difference ?
 and which option to use when (with an example).

I'd just used scoped_session(), as most other folks do already, and seem
to not be bothered by the fact that it uses thread local variables.  If
thread local variables bother you, you can avoid their use by following
the instructions in that link.  If you dont care, don't bother.  There
is no appreciable performance benefit to using one or the other.

- C



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



Async web apps with pyramid

2011-06-16 Thread Raviteja
Hi everyone,

How can we invoke multiple threads of processing from the view handler, so
that the threads run independently and provide results, which will be
returned by the view handler? The threads described above will invoke
requests to external API's.

Can anyone help me out in this.

Thanks,
Ravi
--
Raviteja
http://about.me/raviteja

-- 
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: Async web apps with pyramid

2011-06-16 Thread Chris McDonough
On Fri, 2011-06-17 at 00:25 +0530, Raviteja wrote:
 Hi everyone,
 
 
 How can we invoke multiple threads of processing from the view
 handler, so that the threads run independently and provide results,
 which will be returned by the view handler? The threads described
 above will invoke requests to external API's.
 
 
 Can anyone help me out in this.

1) Please don't cross post.

2) The email address you're using is apparently not subscribed to either
of these maillists, so I had to approve your mails so they'll be
delivered.  Please fix.

Async support is outside the scope of the Pyramid docs themselves.
There are ways to do async using Pyramid, but they'll involve using
something like gevent's WSGI server.  Because this isn't a feature of
Pyramid, you'll need to read the gevent docs and likely, if you have
questions, ask the gevent folks about how best to do long polling and
such (as opposed to asking here).

- C



-- 
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: Simple Jquery AJAX question

2011-06-16 Thread AwaisMuzaffar
Thanks for the reply. It has been very helpful.

Regards,
Awais

On Jun 16, 4:47 pm, Michael Merickel mmeri...@gmail.com wrote:
 On Thu, Jun 16, 2011 at 10:03 AM, AwaisMuzaffar 
 awais1...@googlemail.comwrote:

     config.add_route('ajax', '/ajax/', view='testproject.views.ajax')

     def ajax(request):
         string = 'hello world'
         return Response(string)

 This is fine, but there are 2 enhancements you may want to use in your
 Pyramid code.

 First, if you want to expand your interface to be more restful in the
 future, you may want to separate your config using predicates to match POST
 requests to certain views and GET requests to other views. The other thing
 is that you can utilize Pyramid's renderers to avoid having to return a full
 Response object yourself. As an example, set the renderer to 'json' (or if
 you do it in add_route then it's the view_renderer).

 config.add_route('ajax', '/ajax')
 config.add_view(route_name='ajax', view='testproject.views.ajax',
 request_method='POST', renderer='json')

 From your view code you can then:

     return 'hello world'

 and it will be json serialized for you.

 --

 Michael

-- 
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: sqlalchemy version in pylons 1.0

2011-06-16 Thread Wyatt Baldwin
On Thursday, June 16, 2011 10:13:57 AM UTC-7, monax wrote:

 Hello!

 What problem can I have if I will use sqlalchemy version 0.7 with pylons 
 1.0? Pylons 1.0 uses sqlalchemy version 0.5 by default.


Pylons doesn't depend on SQLAlchemy, so there shouldn't be any problems at 
all.

When you create a Pylons project using `paster create -t pylons`, you can 
choose to include some SQLAlchemy configuration, which I'm pretty sure is 
compatible with 0.7. If it's not, it's just a few lines of code to update.

-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/3DTM1u0LQZgJ.
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: sqlalchemy version in pylons 1.0

2011-06-16 Thread Thomas G. Willis
it's the orm code that you write that might have a problem with sqla 0.7. 
Not pyramid. And only you can know if your model code will have a problem 
running on sqla 0.7

I can say with certainty that the model code I am working on works just fine 
on sqla 0.7, no issues whatsoever. Also,  views that I route requests to via 
pyramid that in turn consume/produce model objects from that code also work 
with no issues whatsoever.



-- 
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/xRQGbHBEFzUJ.
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: How can I specify the log file for Pyramid ?

2011-06-16 Thread Zhang Jiawei
And actually I hope all the stuffs go to uwsgi log file now, will go to the
log file in production.ini I specified. Is this possible ?

2011/6/17 Zhang Jiawei ghos...@gmail.com

 Thanks Chris.

 And I have another question about logging.

 I can start pyramid with uwsgi successfully now, and the logging info is
 written to the log file I specified path in the production.ini, but I found
 exceptions raised in view will be logged to the file which is specified by
 uwsgi not the one in production.ini, any handy configuration can change this
 behavior ?

 I know this is not a problem when start pyramid app by paster serve
 xxx.ini, but it happens for the uwsgi case. Since I set RotatingFileHandler
 in production.ini, I don't hope the error log will be output to uwsgi side.

 The only way I think is set context=Exception on a exception_view, but it
 sounds tricky, maybe there is a easier way ?


 2011/6/17 Chris McDonough chr...@plope.com

 On Thu, 2011-06-16 at 09:06 +0800, Zhang Jiawei wrote:
  I don't see anyway in documentation mentioned this, anyone can post a
  url will be helpful.
 
  And maybe add this part to narrative documentation will be useful for
  the fresh man.


 http://docs.pylonsproject.org/projects/pyramid/1.0/narr/project.html#the-myproject-projectshows
  the default configuration file.  The stuff under begin logging
 configuration is the logging configuration.  These is the standard Python
 logging module .ini configuration settings, documented at e.g.
 http://docs.python.org/release/2.5.2/lib/logging-config-fileformat.html .

 - C


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




-- 
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: How can I specify the log file for Pyramid ?

2011-06-16 Thread Zhang Jiawei
Thanks Chris.

And I have another question about logging.

I can start pyramid with uwsgi successfully now, and the logging info is
written to the log file I specified path in the production.ini, but I found
exceptions raised in view will be logged to the file which is specified by
uwsgi not the one in production.ini, any handy configuration can change this
behavior ?

I know this is not a problem when start pyramid app by paster serve
xxx.ini, but it happens for the uwsgi case. Since I set RotatingFileHandler
in production.ini, I don't hope the error log will be output to uwsgi side.

The only way I think is set context=Exception on a exception_view, but it
sounds tricky, maybe there is a easier way ?

2011/6/17 Chris McDonough chr...@plope.com

 On Thu, 2011-06-16 at 09:06 +0800, Zhang Jiawei wrote:
  I don't see anyway in documentation mentioned this, anyone can post a
  url will be helpful.
 
  And maybe add this part to narrative documentation will be useful for
  the fresh man.


 http://docs.pylonsproject.org/projects/pyramid/1.0/narr/project.html#the-myproject-projectshows
  the default configuration file.  The stuff under begin logging
 configuration is the logging configuration.  These is the standard Python
 logging module .ini configuration settings, documented at e.g.
 http://docs.python.org/release/2.5.2/lib/logging-config-fileformat.html .

 - C


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



-- 
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: Benchmark of paster

2011-06-16 Thread Eric Lemoine
On Thursday, June 16, 2011, Liju lij...@gmail.com wrote:
 Has someone done a benchmark for paster server ? As per the
 documentation to deploy pyramid using ngnix in the mix (for load
 balancing etc) paster is used. I have also seen in this and other
 forums that folks use this architecture in production. So it will be
 good to know how paster perform  how stable it is.


I have observed that Paste Server has a per-request overhead that is
significantly larger than Apache mod_wsgi.  Sorry I have no numbers to
back this.

-- 
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-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: How can I specify the log file for Pyramid ?

2011-06-16 Thread Chris McDonough
On Fri, 2011-06-17 at 08:57 +0800, Zhang Jiawei wrote:
 Thanks Chris.
 
 And I have another question about logging.


 I can start pyramid with uwsgi successfully now, and the logging info
 is written to the log file I specified path in the production.ini, but
 I found exceptions raised in view will be logged to the file which is
 specified by uwsgi not the one in production.ini, any handy
 configuration can change this behavior ?

Nope.

- C


-- 
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: Pyramid with SQLAlchemy (Non-Gobal session)

2011-06-16 Thread Michael Merickel
On Thu, Jun 16, 2011 at 12:38 AM, Liju lij...@gmail.com wrote:

 The documentation says 'It’s sometimes advantageous to not use
 SQLAlchemy’s thread-scoped sessions'.


The issue isn't with scoped_session as much as it has to do with using a
global variable to store your database connections. It just works out that
if you avoid using a global variable, you don't need the protection of
scoped_sessions because everything in pyramid is per-request (which is
per-thread) already.

The reasons to avoid using a global scoped_session are the same as the
reasons to avoid any global variable. It's true that each request is
processed in a separate thread (or greenlet as the case may be). However,
that doesn't address the issue of running multiple applications in the same
process. All of a sudden your global variables start stepping on each other
and you have problems. Obviously this is not a common case, but the fact
that pyramid has no global variables, and that there are ways to avoid
creating any in your app as well, can really save your butt when the time
comes.

-- 

Michael

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