Glauco schrieb:
> vimal ha scritto:
>> hi all,
>>
>> how should i send a multiple parameter get data using a link
>> string
>>
>>
>> i tried one like "href=vs/index/?cn_id=cn_id & vs_id=vs_id"
>> but i get an error saying invalid token...not well formed
>>
>>
>
> space in urlquoted parameters cause this error
>
> another advice, don't create manually url parameter...
>
> use urllib
>
> import urllib
> urllib.urlencode({'cn_id':3, 'vs_id':'boo'})
The spaces are wrong, but do not cause the error. It's not well formed
XML because of the & which must be escaped as &.
If you use urlencode, as suggested,
<?python from import urllib import urlencode ?>
<a href="vs/index/?${urlencode({'cn_id': 3, 'vs_id': 'boo'})}">bla</a>
then the & will be automatically escaped. Even easier:
<a href="${tg.url('vs/index/', cn_id=3, vs_id='boo')}">bla</a>
tg.url is by default available in every template.
-- Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---