Re: Fast Python webserver

2007-02-19 Thread Max Ischenko



On Feb 19, 12:21 am, Bob Ippolito [EMAIL PROTECTED] wrote:
 I'm curious as to why anyone would want to use FastCGI in the first
 place if proxying is available? Implementation wise, there's very
 little reason why FastCGI would be markedly faster or slower than the
 HTTP protocol.

May be due to lack of appropriate knowledge?

For instance, official Pylons deployment docs talks about FastCGI plus
Apache option only. Pylons wiki lists more deployment option but I am
not sure whether it covers proxying setup either (I am not sure what
is this really).

Max.


--~--~-~--~~~---~--~~
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: ANN: AuthKit 0.3.0pre4

2007-02-19 Thread James Gardner

Hi Cliff and Robert,

There was a simple typo in 0.3.0pre4 which meant none of the config data 
was getting passed correctly to the middleware. Thanks for pointing it 
out. I corrected it and released 0.3.0pre5 so you should upgrade to 
that. It isn't an issue with your application Cliff!

 To add another data point, I upgraded to svn version 57 (pre5?) from v43 and 
 it 
 all worked as expected. It even appears to have corrected an intermittent 
 problem someone reported while testing where the authkit cookie was being set 
 to 
 an empty string, using a host with a leading dot in addition to an existing 
 authkit cookie set to the correct value, using a host w/o a leading dot. I 
 hadn't had a chance to try and chase down this issue, so having it go away is 
 a 
 good thing. FWIW, I'm using forwarding along with RemoteUser() and middleware.

The cookie handling was tweaked a bit too a while ago and has some extra 
options now including server side expiring and including the client IP. 
The middleware also removes the cookie if it has a bad digest rather 
than raising an exception.

There is OpenID authentication support in this version too.

Cheers,

James

--~--~-~--~~~---~--~~
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: problems with paster serve reload

2007-02-19 Thread Damjan

 I've been getting this on Gentoo ever since I started using Pylons two
 months ago, on two different versions of Pylons and Paste (both Python
 2.4.x).  Only I don't have to modify any files; merely running paster
 serve --reload and ctrl-c is enough to leave threads running which
 have to be manually killed.  On the other hand it *does* reload files
 properly I think.

As far as I understand paster restarts the whole process, so ofcourse
it *reloads* properly :)

Is it possible that Gentoo has some patched Python version? I don't
remember ever happening to me that CTRL-C would not kill the server. I
use Slackware and ArchLinux and Python 2.4 (2.4.2 and 2.4.4).



--~--~-~--~~~---~--~~
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: Fast Python webserver

2007-02-19 Thread Jose Galvez

Of all the apache setups, proxying is by far the simplest, and with
Apache 2.2 proxy ajp is faster then http
Jose

Max Ischenko wrote:

 On Feb 19, 12:21 am, Bob Ippolito [EMAIL PROTECTED] wrote:
   
 I'm curious as to why anyone would want to use FastCGI in the first
 place if proxying is available? Implementation wise, there's very
 little reason why FastCGI would be markedly faster or slower than the
 HTTP protocol.
 

 May be due to lack of appropriate knowledge?

 For instance, official Pylons deployment docs talks about FastCGI plus
 Apache option only. Pylons wiki lists more deployment option but I am
 not sure whether it covers proxying setup either (I am not sure what
 is this really).

 Max.


 

   


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



QuickWiki tutorial doesn't work for me. Error in paster make-config QuickWiki test.ini

2007-02-19 Thread Valery

Hi all,

I see the problem is already known, but i am not sure about the status
of
the solution/patch. I am just trying Pylons so getting through the
tutorials
would be quite logical and important for me...

The error is copy-pasted below.
Thanks for any hints in advance
--
Valery



$ paster make-config QuickWiki test.ini
Distribution already installed:
  QuickWiki 0.1.3 from /usr/lib/python2.4/site-packages/
QuickWiki-0.1.3-py2.4.egg
Traceback (most recent call last):
  File /usr/bin/paster, line 7, in ?
sys.exit(
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/command.py, line 76, in run
invoke(command, command_name, options, args[1:])
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/command.py, line 115, in invoke
exit_code = runner.run(args)
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/appinstall.py, line 64, in run
return super(AbstractInstallCommand, self).run(new_args)
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/command.py, line 210, in run
result = self.command()
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/appinstall.py, line 324, in command
self.installer.write_config(self, self.config_file, self.vars)
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/appinstall.py, line 496, in write_config
command.ensure_file(filename, self.config_content(command, vars))
  File /usr/lib/python2.4/site-packages/PasteScript-1.1-py2.4.egg/
paste/script/appinstall.py, line 526, in config_content
searchList=[vars])
  File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
i686.egg/Cheetah/Template.py, line 1200, in __init__
self._compile(source, file, compilerSettings=compilerSettings)
  File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
i686.egg/Cheetah/Template.py, line 1488, in _compile
keepRefToGeneratedCode=True)
  File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
i686.egg/Cheetah/Template.py, line 716, in compile
compiler.compile()
  File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
i686.egg/Cheetah/Compiler.py, line 1643, in compile
self._parser.parse()
  File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
i686.egg/Cheetah/Parser.py, line 1445, in parse
self.assertEmptyOpenDirectivesStack()
  File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
i686.egg/Cheetah/Parser.py, line 2554, in
assertEmptyOpenDirectivesStack
raise ParseError(self, msg=errorMsg)
Cheetah.Parser.ParseError:

Some #directives are missing their corresponding #end ___ tag: cache
Line 45, column 18

Line|Cheetah Code
|-
42  |# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION
ENVIRONMENT*
43  |# Debug mode will enable the interactive debugging tool, allowing
ANYONE to
44  |# execute malicious code after an exception is raised.
45  |set debug = false


--~--~-~--~~~---~--~~
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: QuickWiki tutorial doesn't work for me. Error in paster make-config QuickWiki test.ini

2007-02-19 Thread Cliff Wells

On Mon, 2007-02-19 at 23:14 +, Valery wrote:
   File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
 i686.egg/Cheetah/Parser.py, line 1445, in parse
 self.assertEmptyOpenDirectivesStack()
   File /usr/lib/python2.4/site-packages/Cheetah-2.0rc7-py2.4-linux-
 i686.egg/Cheetah/Parser.py, line 2554, in
 assertEmptyOpenDirectivesStack
 raise ParseError(self, msg=errorMsg)
 Cheetah.Parser.ParseError:
 
 Some #directives are missing their corresponding #end ___ tag: cache
 Line 45, column 18
 
 Line|Cheetah Code
 |-
 42  |# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION
 ENVIRONMENT*
 43  |# Debug mode will enable the interactive debugging tool, allowing
 ANYONE to
 44  |# execute malicious code after an exception is raised.
 45  |set debug = false
 

Believe it or not, this probably has nothing to do with Pylons.  Rather,
because Cheetah supports the python.templating_engines entry point,
Cheetah is gets imported automatically whether you use it or not and
apparently your version of Cheetah is broken.  Try upgrading or
uninstalling Cheetah.

Regards,
Cliff



--~--~-~--~~~---~--~~
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: QuickWiki tutorial doesn't work for me. Error in paster make-config QuickWiki test.ini

2007-02-19 Thread Valery

Hi  Cliff

 Believe it or not, this probably has nothing to do with Pylons.  Rather,
 because Cheetah supports the python.templating_engines entry point,
 Cheetah is gets imported automatically whether you use it or not and
 apparently your version of Cheetah is broken.  Try upgrading or
 uninstalling Cheetah.

uninstalling sounds more radical for me... upgrade means that
the version of Cheetah automatically downloaded an hour ago
was somehow out-of-date? you probably mean upgrade to
the development version. how to upgrade then?
I am newbie in Python's world :)

thanks
--
Valery


--~--~-~--~~~---~--~~
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: QuickWiki tutorial doesn't work for me. Error in paster make-config QuickWiki test.ini

2007-02-19 Thread Cliff Wells

On Tue, 2007-02-20 at 00:12 +, Valery wrote:
 Hi  Cliff
 
  Believe it or not, this probably has nothing to do with Pylons.  Rather,
  because Cheetah supports the python.templating_engines entry point,
  Cheetah is gets imported automatically whether you use it or not and
  apparently your version of Cheetah is broken.  Try upgrading or
  uninstalling Cheetah.
 
 uninstalling sounds more radical for me... upgrade means that
 the version of Cheetah automatically downloaded an hour ago
 was somehow out-of-date? you probably mean upgrade to
 the development version. how to upgrade then?
 I am newbie in Python's world :)

Actually the latest release in the Cheese shop is 1.0. and you've
installed 2.0rc7.  I'm not sure how you installed, but I suggest you
remove your existing version and reinstall using easy_install Cheetah
which should work fine.

Regards,
Cliff




--~--~-~--~~~---~--~~
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: Nested resources with map.resources?

2007-02-19 Thread wyatt-bC

[I've tried posting this twice already, and it never showed up. Maybe
it'll work this time, as I just made some other posts that came
through.]


On Feb 10, 9:36 pm, Ben Bangert [EMAIL PROTECTED] wrote:
 On Feb 10, 7:31 pm, wyatt-bC [EMAIL PROTECTED] wrote:

  map.resources :articles do |article|
  map.resources :comments
  end

There is a subtle error in this. It should be:

map.resources :articles do |article|
article.resources :comments
end


  This produces routes like...

  /articles
  /articles/1
  /articles/1/comments
  /articles/1/comments/1
  etc.

 What is the comments controller called that corresponds to this
 mapping?

It's just called Comments. I guess if you wanted comments nested
under
different top level resources, you'd need multiple comment controllers
(though
it seems you wouldn't always need/want more than one).


  I'm not sure exactly how you'd translate the Ruby above directly to
  Python, but I think it would be cool if Pylons had this feature... and
  I'd be glad to volunteer some time to working on it. Would this be
  fairly straightforward given the current architecture of Routes?

 In Routes, it'd prolly require explicitly adding the stuff the mapping
 anonymous block is doing, which is probably something like this:

 map.resource('comment', 'comments', controller='article_comments',
 name_prefix='article_', path_prefix='articles/:article_id')

How about:

map.resource('article', 'articles')
map.resource('user', 'users')
map.resource('comment', 'comments', nested_under='articles')
map.resource('comment', 'comments', nested_under='users')

One thing that's cool about the Rails version is that you can nest
multiple resources at once inside the block:

map.resources :articles do |article|
article.resources :comments
article.resources :tags
end

My question is, what sort of object is `article`? map.resource could
return the `article` thingie, then the Python version could look like
this:

article = map.resource('article', 'articles')
article.resource('comment', 'comments')
article.resource('comment', 'comments')


 That will need an ArticleComments controller, and the actions in it
 will get an article_id argument in addition to the normal args a
 mapped resource will get. The name_prefix will affect the named routes
 created, so you could do:
 url_for('article_comment', action='show', id=2)

Rails does something like comment_path(self.article, self.comment) to
generate /articles/13/comment/4. comment_path is an automatically
generated helper. There's an blog post that goes over some of at
http://ariejan.net/2007/01/23/rails-nested-resource-scaffold/.


__wyatt


--~--~-~--~~~---~--~~
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: Nested resources with map.resources?

2007-02-19 Thread wyatt-bC

On Feb 19, 7:12 pm, wyatt-bC [EMAIL PROTECTED] wrote:

...

 map.resources :articles do |article|
 article.resources :comments
 end

...

   I'm not sure exactly how you'd translate the Ruby above directly to
   Python, but I think it would be cool if Pylons had this feature... and
   I'd be glad to volunteer some time to working on it. Would this be
   fairly straightforward given the current architecture of Routes?

  In Routes, it'd prolly require explicitly adding the stuff the mapping
  anonymous block is doing, which is probably something like this:

  map.resource('comment', 'comments', controller='article_comments',
  name_prefix='article_', path_prefix='articles/:article_id')

 How about:

 map.resource('article', 'articles')
 map.resource('user', 'users')
 map.resource('comment', 'comments', nested_under='articles')
 map.resource('comment', 'comments', nested_under='users')

 One thing that's cool about the Rails version is that you can nest
 multiple resources at once inside the block:

 map.resources :articles do |article|
 article.resources :comments
 article.resources :tags
 end

 My question is, what sort of object is `article`? map.resource could
 return the `article` thingie, then the Python version could look like
 this:

 article = map.resource('article', 'articles')
 article.resource('comment', 'comments')
 article.resource('tag', 'tags')

Or maybe a `with` version would work:

with map.resource('article', 'article') as article:
article.resource('comment', 'comments')
article.resource('tag', 'tags')

This at least looks similar to the Rails version (though maybe not a
proper use of `with`?).


...

__wyatt


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



Returning generator as Response.content

2007-02-19 Thread askel

Hello everyone,

I'm trying to implement server-push functionality using multipart/x-
mixed-replace content type as following:

# in theory, this function should run forever or until connection is
closed
def generate_stream(boundary):
 boundary = '\n%s\n' % boundary
 yield boundary
 # returns initial content, does not block
 yield get_update(True)
 yield boundary
 while 1:
  # wait for changes, can block for relatively long time
  yield get_update()
  yield boundary
...
def action(self):
 resp = Response(mimetype='multipart/x-mixed-
replace;boundary=PartBoundary')
 resp.content = generate_stream('PartBoundary')
 return resp

I never get any response from above action. Moreover, even when I drop
connection to server that generator function keeps running. It seems
that Pylons never sends anything back to client until it gets full
content, which in that scenario would never happen. I tried to run
that application with both Paste#http and flup#fastcgi and result are
the same - nothing is being sent to client.

I saw few posts on similar subject but none of them had a solution.

Any help is greatly appreciated.


--~--~-~--~~~---~--~~
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: Nested resources with map.resources?

2007-02-19 Thread Ian Bicking

wyatt-bC wrote:
 On Feb 10, 9:36 pm, Ben Bangert [EMAIL PROTECTED] wrote:
 On Feb 10, 7:31 pm, wyatt-bC [EMAIL PROTECTED] wrote:

 map.resources :articles do |article|
 map.resources :comments
 end
 
 There is a subtle error in this. It should be:
 
 map.resources :articles do |article|
 article.resources :comments
 end
 
 
 This produces routes like...
 /articles
 /articles/1
 /articles/1/comments
 /articles/1/comments/1
 etc.
 What is the comments controller called that corresponds to this
 mapping?
 
 It's just called Comments. I guess if you wanted comments nested
 under
 different top level resources, you'd need multiple comment controllers
 (though
 it seems you wouldn't always need/want more than one).

Well, Routes notwithstanding, I'd be inclined to say that /articles/1/ 
should point to an ArticleController or something like that, and it 
should handle the rest of the path (maybe with routes).  You could use 
the ability to match the rest of the path as PATH_INFO to do this, 
though I don't think there's a simple way to run another route against 
that (not a terribly hard way, but no guidance).  I don't see why the 
routes really have to be flat (i.e., one big list of routes for the 
entire app).

-- 
Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org

--~--~-~--~~~---~--~~
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: Returning generator as Response.content

2007-02-19 Thread Ben Bangert

On Feb 19, 2007, at 7:29 PM, askel wrote:

 I never get any response from above action. Moreover, even when I drop
 connection to server that generator function keeps running. It seems
 that Pylons never sends anything back to client until it gets full
 content, which in that scenario would never happen. I tried to run
 that application with both Paste#http and flup#fastcgi and result are
 the same - nothing is being sent to client.

 I saw few posts on similar subject but none of them had a solution.

Are you running in debug mode? If the debug is active (the default  
development.ini does this), then all output is swallowed before being  
streamed out. This is to allow the exception formatter to hook in  
properly. When turning debug off, you will get proper streaming.

HTH,
Ben

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