apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Hi,

I use Pylons 1.0 Framework and mod_wsgi on production server.

I can use my application but randomly 1 request on 10 I've error :

Internal Server Error in browser and in error log file :

[client 82.231.115.1] Premature end of script headers: demo.wsgi, 
referer: http://example.com/


I've read already many documentation page about this issue on mod_wsgi 
and Pylons website.


Have you some idea about this error ?

More information about my configuration :

* I use apache2 from Debian package
* I've compiled Python 2.6 from source code
* I've compiled mod_wsgi-3.3 from source code (I've also tested with 
mod_wsgi-2.8, same error)


VirtualHost *:80
ServerName example.com

IfModule mod_wsgi.c

WSGIScriptAlias / /home/examplecom/demo/demo.wsgi
WSGIDaemonProcess mydemo threads=1 maximum-requests=500 
inactivity-timeout=500 processes=1 display-name=%{GROUP}

WSGIProcessGroup mydemo
WSGIApplicationGroup %{GLOBAL}

/IfModule

ErrorLog /home/examplecom/demo/error.log
LogLevel info

/VirtualHost

Thanks for your help.

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.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: [modwsgi] apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
On 8 December 2010 20:37, Stéphane Klein steph...@harobed.org wrote:
 Hi,

 I use Pylons 1.0 Framework and mod_wsgi on production server.

 I can use my application but randomly 1 request on 10 I've error :

 Internal Server Error in browser and in error log file :

 [client 82.231.115.1] Premature end of script headers: demo.wsgi, referer:
 http://example.com/

Need to see the error messages before and after this and for matching
time in main Apache error log if you are using a virtual host specific
error log.

This message will arise in a few circumstances.

The first is that WSGI script file is being executed as a CGI script
for some reason.

The second is that the mod_wsgi daemon process is crashing.

The third is that daemon process is being forcibly restarted while
there are active requests which haven't responded in time.

 I've read already many documentation page about this issue on mod_wsgi and
 Pylons website.

 Have you some idea about this error ?

 More information about my configuration :

 * I use apache2 from Debian package
 * I've compiled Python 2.6 from source code
 * I've compiled mod_wsgi-3.3 from source code (I've also tested with
 mod_wsgi-2.8, same error)

 VirtualHost *:80
    ServerName example.com

    IfModule mod_wsgi.c

        WSGIScriptAlias / /home/examplecom/demo/demo.wsgi
        WSGIDaemonProcess mydemo threads=1 maximum-requests=500
 inactivity-timeout=500 processes=1 display-name=%{GROUP}

A very odd configuration.

You are running a single process with a single thread in it.

That it is a single thread only though, means that you can't be
incurring third possibility above though as a forced restart due to
maximum requests being reached as there can't be a concurrent request
that is being interrupted.

You can get a forced shutdown when request is still current due to
inactivity timeout if the request hangs for 500 seconds for your
configuration, but in that case I would say you would notice the hang
given that that is almost 10 minutes before that could kick in.

I would suggest so as to get more information if it is something
related to maximum requests or inactivity timeout, that you ensure
using:

  LogLevel info

in Apache configuration and not the default:

  LogLevel warn

Have a good look for segmentation fault messages in main Apache error
log as well.

Graham

        WSGIProcessGroup mydemo
        WSGIApplicationGroup %{GLOBAL}

    /IfModule

    ErrorLog /home/examplecom/demo/error.log
    LogLevel info

 /VirtualHost

 Thanks for your help.

 Regards,
 Stephane
 --
 Stéphane Klein steph...@harobed.org - French
 blog: http://stephane-klein.info
 twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.com

 --
 You received this message because you are subscribed to the Google Groups
 modwsgi group.
 To post to this group, send email to modw...@googlegroups.com.
 To unsubscribe from this group, send email to
 modwsgi+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/modwsgi?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.



Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 10:54, Graham Dumpleton a écrit :

On 8 December 2010 20:37, Stéphane Kleinsteph...@harobed.org  wrote:

Hi,

I use Pylons 1.0 Framework and mod_wsgi on production server.

I can use my application but randomly 1 request on 10 I've error :

Internal Server Error in browser and in error log file :

[client 82.231.115.1] Premature end of script headers: demo.wsgi, referer:
http://example.com/


Need to see the error messages before and after this and for matching
time in main Apache error log if you are using a virtual host specific
error log.

This message will arise in a few circumstances.



This is more information messages :

http://pastebin.com/myi5D5Xn

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.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: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 11:21, Stéphane Klein a écrit :

Le 08/12/2010 10:54, Graham Dumpleton a écrit :

On 8 December 2010 20:37, Stéphane Kleinsteph...@harobed.org wrote:

Hi,

I use Pylons 1.0 Framework and mod_wsgi on production server.

I can use my application but randomly 1 request on 10 I've error :

Internal Server Error in browser and in error log file :

[client 82.231.115.1] Premature end of script headers: demo.wsgi,
referer:
http://example.com/


Need to see the error messages before and after this and for matching
time in main Apache error log if you are using a virtual host specific
error log.

This message will arise in a few circumstances.



This is more information messages :

http://pastebin.com/myi5D5Xn


Well, I see the last message of this thread : 
http://groups.google.com/group/modwsgi/browse_thread/thread/ba82b2643564d2dd


He say :

Last night we installed mod_wsgi 3.3, and the KeyErrors have totally
disappeared.  I highly recommend the 3.3 upgrade if you're having this
problem.  Thanks, Graham.

In my test, I've tested mod_wsgi 3.3 and 2.8
In last log message, it's 2.8 version.

Now I've reinstalled 3.3 version, this is the new log messages :

http://pastebin.com/kKztWiCY

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.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: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
Logs show the segmentation faults I speak of:

[Wed Dec 08 11:32:47 2010] [error] [client 82.231.115.1] Premature end
of script headers: demo.wsgi, referer: http://example.com/employees/
[Wed Dec 08 11:32:47 2010] [notice] child pid 22620 exit signal
Segmentation fault (11)

Attach gdb to daemon process as described in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

enter 'cont' command so runs again and then keep firing off requests
until it crashes.

Suggest removing maximum-requests during that time so that process
isn't restarted because of that number being exceeded.

In other words, debug why process is crashing.

For ideas of why, see:

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

Graham

On 8 December 2010 21:37, Stéphane Klein steph...@harobed.org wrote:
 Le 08/12/2010 11:21, Stéphane Klein a écrit :

 Le 08/12/2010 10:54, Graham Dumpleton a écrit :

 On 8 December 2010 20:37, Stéphane Kleinsteph...@harobed.org wrote:

 Hi,

 I use Pylons 1.0 Framework and mod_wsgi on production server.

 I can use my application but randomly 1 request on 10 I've error :

 Internal Server Error in browser and in error log file :

 [client 82.231.115.1] Premature end of script headers: demo.wsgi,
 referer:
 http://example.com/

 Need to see the error messages before and after this and for matching
 time in main Apache error log if you are using a virtual host specific
 error log.

 This message will arise in a few circumstances.


 This is more information messages :

 http://pastebin.com/myi5D5Xn

 Well, I see the last message of this thread :
 http://groups.google.com/group/modwsgi/browse_thread/thread/ba82b2643564d2dd

 He say :

 Last night we installed mod_wsgi 3.3, and the KeyErrors have totally
 disappeared.  I highly recommend the 3.3 upgrade if you're having this
 problem.  Thanks, Graham.

 In my test, I've tested mod_wsgi 3.3 and 2.8
 In last log message, it's 2.8 version.

 Now I've reinstalled 3.3 version, this is the new log messages :

 http://pastebin.com/kKztWiCY

 Regards,
 Stephane
 --
 Stéphane Klein steph...@harobed.org - French
 blog: http://stephane-klein.info
 twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.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: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 11:52, Graham Dumpleton a écrit :

Logs show the segmentation faults I speak of:

[Wed Dec 08 11:32:47 2010] [error] [client 82.231.115.1] Premature end
of script headers: demo.wsgi, referer: http://example.com/employees/
[Wed Dec 08 11:32:47 2010] [notice] child pid 22620 exit signal
Segmentation fault (11)

Attach gdb to daemon process as described in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

enter 'cont' command so runs again and then keep firing off requests
until it crashes.



This is the debug message :

http://pastebin.com/q9Lb72vQ

Regards,
Stephane
--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.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: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
No clues unfortunately, just looks like arbitrary memory corruption.

Do make sure you aren't loading mod_python into same Apache.

Other than that, looks like a C extension module may be corrupting memory.

What C extension modules for Python are you using?

Graham

On 8 December 2010 22:14, Stéphane Klein steph...@harobed.org wrote:
 Le 08/12/2010 11:52, Graham Dumpleton a écrit :

 Logs show the segmentation faults I speak of:

 [Wed Dec 08 11:32:47 2010] [error] [client 82.231.115.1] Premature end
 of script headers: demo.wsgi, referer: http://example.com/employees/
 [Wed Dec 08 11:32:47 2010] [notice] child pid 22620 exit signal
 Segmentation fault (11)

 Attach gdb to daemon process as described in:


 http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

 enter 'cont' command so runs again and then keep firing off requests
 until it crashes.


 This is the debug message :

 http://pastebin.com/q9Lb72vQ

 Regards,
 Stephane
 --
 Stéphane Klein steph...@harobed.org - French
 blog: http://stephane-klein.info
 twitter: http://twitter.com/klein_stephane
 pro: http://www.is-webdesign.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: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Stéphane Klein

Le 08/12/2010 12:20, Graham Dumpleton a écrit :

No clues unfortunately, just looks like arbitrary memory corruption.

Do make sure you aren't loading mod_python into same Apache.


No, mod_python isn't installed.



Other than that, looks like a C extension module may be corrupting memory.

What C extension modules for Python are you using?


this is more information about library loading found with gdb :

http://pastebin.com/VFPe5BcK

There are some clues in this log ?

Regards,
Stephane

--
Stéphane Klein steph...@harobed.org - French
blog: http://stephane-klein.info
twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.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: webhelpers.paginate GenerationError with url_for() in routes

2010-12-08 Thread Mike Orr
On Tue, Dec 7, 2010 at 11:08 PM, Joel jrwdun...@gmail.com wrote:
 Ok, so I used grep to search for WebHelpers[=] as Mike suggested and
 found:

  /path/to/virtualenv/lib/python2.5/site-packages/FormBuild-2.2.0-
 py2.5.egg/EGG-INFO/requires.txt:WebHelpers=0.6.1,0.6.99

Argh, that could trap other people too. Thanks for letting us know.

I still don't understand why url_for() didn't work, but I'm glad your
application is running again.

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



Weird key problems with beaker_cache (cache depends on domain)

2010-12-08 Thread Juliusz Gonera

Hi,

I'm using beaker_cache to cache results of some actions. The problem is, 
their result (the template used) depends sometimes on the domain which 
is used in the request (the same application is available under 
different domains).


Right now I have something like this:

@beaker_cache(expire=600, query_args=True)
def group(self, id, portal=request.environ.get('HTTP_HOST', '')):

The portal argument is there just to force beaker_cache to include the 
domain in key generation (I didn't find another way). This however, does 
not work as expected.


I try to access the page first using domain1, then domain2. If I do 
raise Exception at the beginning of the action I can see that for 
domain1 key_dict = {'id': u'1', 'portal': 'domain1'}, but for domain2 
key_dict is also {'id': u'1', 'portal': 'domain1'} ! Why is it like 
that? Is the request object somehow cached too? Why? How can I disable it?


Regards,
--
Juliusz Gonera
http://juliuszgonera.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: Weird key problems with beaker_cache (cache depends on domain)

2010-12-08 Thread Marius Gedminas
On Wed, Dec 08, 2010 at 08:29:36PM +0100, Juliusz Gonera wrote:
 I'm using beaker_cache to cache results of some actions. The problem
 is, their result (the template used) depends sometimes on the domain
 which is used in the request (the same application is available
 under different domains).
 
 Right now I have something like this:
 
 @beaker_cache(expire=600, query_args=True)
 def group(self, id, portal=request.environ.get('HTTP_HOST', '')):

That's not going to work -- as you've discovered.

 The portal argument is there just to force beaker_cache to include
 the domain in key generation (I didn't find another way). This
 however, does not work as expected.
 
 I try to access the page first using domain1, then domain2. If I do
 raise Exception at the beginning of the action I can see that for
 domain1 key_dict = {'id': u'1', 'portal': 'domain1'}, but for
 domain2 key_dict is also {'id': u'1', 'portal': 'domain1'} ! Why is
 it like that?

The default value for function arguments is computed during import time.
Pylons imports the controllers dynamically during request processing,
and that's the only reason it even works -- but it uses the HTTP_HOST
value of the first request that triggered the import.

I don't know the correct solution; you might need to write your own
cache decorator.  http://pypi.python.org/pypi/decorator is useful for
those.

Marius Gedminas
-- 
We don't really understand it, so we'll give it to the programmers.


signature.asc
Description: Digital signature


Pyramid Pattern Request: Schema Migrations

2010-12-08 Thread Marius Gedminas
Inspired by 
http://blog.cherouvim.com/a-table-that-should-exist-in-all-projects-with-a-database/

What's a good way to manage schema migrations in a Pyramid project?

SQLAlchemy Migrate is a promising tool for RDBMSes.  What would be a
nice way to integrate it?  Nice, in my book, means things like having

  paster serve myapp.ini

check on startup if the database schema is recent enough and either
perform the necessary migrations automatically -- if the .ini file
allows this -- or abort and tell me what commands to run to perform the
migrations manually.

Last time I tried SQLALchemy Migrate on a Pylons project, I hit a fog of
confusion (what migrate commands do I need to run when, exactly?), and
then, eventually, a brick wall (in the sense of various changes being
unsupported with sqlite, which I wanted to use during development, for
simplicity).  I ended up filing a bunch of issues and reinventing my own
bicycle.  I see that sqlite support is much improved nowadays.

Similarly, when you're using ZODB with Pyramid, is there something like
zope.generations for it?

Marius Gedminas
-- 
It's my understanding that although in principle TCP can handle huge
throughputs in practice many stacks haven't been optimized for that case, so
you have to either use a utility which opens multiple TCP sessions in parallel
or do something really radical like upgrade to the latest version of the linux
kernel.
-- Bram Cohen


signature.asc
Description: Digital signature


Re: apache2 lenny pylons mod_wsgi python 2.6 = error : Premature end of script headers: demo.wsgi, referer: http://example.com/

2010-12-08 Thread Graham Dumpleton
On 9 December 2010 00:34, Stéphane Klein steph...@harobed.org wrote:
 Le 08/12/2010 12:20, Graham Dumpleton a écrit :

 No clues unfortunately, just looks like arbitrary memory corruption.

 Do make sure you aren't loading mod_python into same Apache.

 No, mod_python isn't installed.


 Other than that, looks like a C extension module may be corrupting memory.

 What C extension modules for Python are you using?

 this is more information about library loading found with gdb :

 http://pastebin.com/VFPe5BcK

 There are some clues in this log ?

Only notable things are:

Reading symbols from /usr/lib/libpq.so.5...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libpq.so.5
Reading symbols from /usr/lib/libmysqlclient_r.so.15...(no debugging
symbols found)...done.
Loaded symbols for /usr/lib/libmysqlclient_r.so.15
Reading symbols from /usr/lib/libsqlite3.so.0...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libsqlite3.so.0
Reading symbols from /usr/lib/libexpat.so.1...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libexpat.so.1
Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libxml2.so.2

These are preloaded by Apache or PHP extensions.

If you are using any C extension module for Python which is expecting
different versions of these libraries, you can end up with problems.

If you can, don't load PHP into Apache and see if your problem goes away.

Recommended that you don't use mod_php and mod_wsgi in same Apache if
you can help it.

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: Pyramid Pattern Request: Schema Migrations

2010-12-08 Thread Chris McDonough
On Thu, 2010-12-09 at 03:12 +0200, Marius Gedminas wrote:
 Inspired by 
 http://blog.cherouvim.com/a-table-that-should-exist-in-all-projects-with-a-database/
 
 What's a good way to manage schema migrations in a Pyramid project?

Daniel may murder me for mentioning it (I don't know if he intended it
for public consumption), but he wrote this:

http://bitbucket.org/dholth/stucco_evolution/src

It is a plugin to http://docs.repoze.org/evolution/ for SQLAlchemy.


 SQLAlchemy Migrate is a promising tool for RDBMSes.  What would be a
 nice way to integrate it?  Nice, in my book, means things like having
 
   paster serve myapp.ini
 
 check on startup if the database schema is recent enough and either
 perform the necessary migrations automatically -- if the .ini file
 allows this -- or abort and tell me what commands to run to perform the
 migrations manually.
 
 Last time I tried SQLALchemy Migrate on a Pylons project, I hit a fog of
 confusion (what migrate commands do I need to run when, exactly?), and
 then, eventually, a brick wall (in the sense of various changes being
 unsupported with sqlite, which I wanted to use during development, for
 simplicity).  I ended up filing a bunch of issues and reinventing my own
 bicycle.  I see that sqlite support is much improved nowadays.
 
 Similarly, when you're using ZODB with Pyramid, is there something like
 zope.generations for it?

repoze.evolution is basically the guts of zope.generation.

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



Routes ur() issue with URL

2010-12-08 Thread Jonathan Gardner
I sometimes use Route's url() to do the query args for me. For instance,

  url('http://google.com', q='aasdf')

will give me:

  http://google.com?q=aasdf

which is  a very useful shortcut.

However, I've found that this doesn't work:

  url('http://google.com?q=aasdf', foo='bar')

which gives me:

  http://google.com?q=aasdf?foo=bar

Does it make sense to modify Routes to parse the query before it
applies the args in this special case? I can submit a patch.

-- 
Jonathan Gardner
jgard...@jonathangardner.net

-- 
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: Routes ur() issue with URL

2010-12-08 Thread Mike Orr
On Wed, Dec 8, 2010 at 10:23 PM, Jonathan Gardner
jgard...@jonathangardner.net wrote:
 I sometimes use Route's url() to do the query args for me. For instance,

  url('http://google.com', q='aasdf')

 will give me:

  http://google.com?q=aasdf

 which is  a very useful shortcut.

 However, I've found that this doesn't work:

  url('http://google.com?q=aasdf', foo='bar')

 which gives me:

  http://google.com?q=aasdf?foo=bar

 Does it make sense to modify Routes to parse the query before it
 applies the args in this special case? I can submit a patch.

Use ``webhelpers.util.update_params()`` to add/modify query parameters on a URL:

update_params(http://google.com/?q=aasdf;, foo=bar)
update_params(http://google.com/;, q=aasdf, foo=bar)

BTW, a HTTP URL without a slash after the domain is technically
invalid. The browser or library may add it for you, but it's better to
publish a complete URL.

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