pre-built URL

3 views
Skip to first unread message

Terrence Brannon

unread,
Nov 2, 2008, 4:24:41 AM11/2/08
to Nagare users

I want to have my application go directly to the register page with the
referrer field filled in if the application was visited with a URL
containing a referrer name, eg:

http://localhost:8080/gnumatrix?ref=bob

would render the register form and have the referrer field populated
with 'bob'

I have already altered the RegisterData and RegisterEditor classes with
the referrer field:

http://www.bitbucket.org/metaperl/gnumatrix/changeset/d1928b1eb4bd/#chg-gnumatrix/gnumatrix/gnumatrix.py

but do not know how to detect query string data and change the form
rendering logic based on it.

Vincent Rialland

unread,
Nov 3, 2008, 3:47:28 AM11/3/08
to nagare...@googlegroups.com


2008/11/2 Terrence Brannon <meta...@gmail.com>


I want to have my application go directly to the register page with the
referrer field filled in if the application was visited with a URL
containing a referrer name, eg:

http://localhost:8080/gnumatrix?ref=bob

would render the register form and have the referrer field populated
with 'bob'

I have already altered the RegisterData and RegisterEditor classes with
the referrer field:



but do not know how to detect query string data and change the form
rendering logic based on it.

Hi,
you can use the request.params attribute on your renderer that contains the parameters given in the URL. For example you can test if the referrer is defined and then update the referrer var like this ('h' is your renderer) before the display of the register form :

referrer = h.request.params.get('ref', None)
if referrer is not None:
    self.referrer(referrer)




Terrence Brannon

unread,
Nov 4, 2008, 7:37:07 AM11/4/08
to nagare...@googlegroups.com

Vincent Rialland wrote:
>
> you can use the request.params attribute on your renderer that contains the
> parameters given in the URL.

Ok, that code is written,
http://www.bitbucket.org/metaperl/gnumatrix/src/cecc2df5a610/gnumatrix/gnumatrix/gnumatrix.py#cl-198

but just because the URL has a query string, that does not route the
person to the right page...

the default page for the website is the home page, not the register page.

I've also decided to change the URL scheme a bit:

http://localhost:8080/gnumatrix/register/under/bob

should render the register form with the referrer field set to bob


Terrence Brannon

unread,
Nov 4, 2008, 9:34:00 AM11/4/08
to Nagare users
Ok Vincent has helped me generously in #nagare

I have it working... the changeset is here -
http://www.bitbucket.org/metaperl/gnumatrix/changeset/f28f802adb10/

A sample app does something similar, but is a little more complex:
http://www.nagare.org/trac/browser/trunk/nagare/examples/nagare/examples/wiki/wiki9.py



Reply all
Reply to author
Forward
0 new messages