On Oct 21, 2010, at 10:01 AM, Jonathan Lundell wrote:
> On Oct 21, 2010, at 9:55 AM, Jason Brower wrote:
>> This gets me pretty close!
>> I can't put spaces in the field... is there a way to do that?
>> In the end I will be parsing by space for a search feature I am trying to
>> implement.
>
> I'd have to look at the code (don't have time right now), but you might try
> encoding spaces as either %20 or underscore, and see what happens.
OK, I took a quick look. When URL() builds the URL, it uses urllib.urlencode to
build the query string. Quoting the Python docs:
> urllib.urlencode(query[, doseq])
> Convert a mapping object or a sequence of two-element tuples to a
> “percent-encoded” string, suitable to pass to urlopen() above as the optional
> data argument. This is useful to pass a dictionary of form fields to a POST
> request. The resulting string is a series of key=valuepairs separated by '&'
> characters, where both key and value are quoted using quote_plus() above.
> When a sequence of two-element tuples is used as the query argument, the
> first element of each tuple is a key and the second is a value. The value
> element in itself can be a sequence and in that case, if the optional
> parameter doseq is evaluates to True, individual key=value pairs separated by
> '&' are generated for each element of the value sequence for the key. The
> order of parameters in the encoded string will match the order of parameter
> tuples in the sequence. The urlparse module provides the functions parse_qs()
> and parse_qsl() which are used to parse query strings into Python data
> structures.
> urllib.quote_plus(string[, safe])
> Like quote(), but also replaces spaces by plus signs, as required for quoting
> HTML form values when building up a query string to go into a URL. Plus signs
> in the original string are escaped unless they are included in safe. It also
> does not have safe default to '/'.
> urllib.quote(string[, safe])
> Replace special characters in string using the %xx escape. Letters, digits,
> and the characters '_.-' are never quoted. By default, this function is
> intended for quoting the path section of the URL.The optional safe parameter
> specifies additional characters that should not be quoted — its default value
> is '/'.
>
> Example: quote('/~connolly/') yields '/%7econnolly/'.
>
>> Best Regards,
>> Jason Brower
>>
>> On Thu, 2010-10-21 at 07:42 -0700, Jonathan Lundell wrote:
>>> On Oct 21, 2010, at 1:51 AM, Jason Brower wrote:
>>>> It was my understanding that you called it as such...
>>>> request.vars.variable_name
>>>> So I want it so I can set the variable_name and it would respond with it's
>>>> contents.
>>>>
>>>
>>>
>>> request.vars is basically a Python dict, and subject to its rules.
>>>
>>>
>>> So you might want to make it
>>>
>>>
>>> http://127.0.0.1:8000/furniture/default/results?foo=sdfsafsdfa%C3%A4%C3%A4%C3%A4
>>>
>>>
>>> and refer to request.vars.foo
>>>
>>>
>>>
>>>
>>>
>>>> BR,
>>>> Jason
>>>>
>>>> On Wed, 2010-10-20 at 22:47 -0700, Jonathan Lundell wrote:
>>>>> On Oct 20, 2010, at 10:34 PM, Jason Brower wrote:
>>>>>> That works, but how do I load that data?
>>>>>>
>>>>>
>>>>>
>>>>> What do you want to do with it? It should show up in request.vars, I
>>>>> think.
>>>>>
>>>>>>
>>>>>> On Wed, 2010-10-20 at 19:57 -0700, Jonathan Lundell wrote:
>>>>>>> On Oct 20, 2010, at 7:52 PM, Jason Brower wrote:
>>>>>>>> For example, if I put...
>>>>>>>> http://127.0.0.1:8000/furniture/default/results/sdfsafsdfa%C3%A4%C3%A4%C3%A4
>>>>>>>> It will not work and tells me I have an invalid controller.
>>>>>>>> http://127.0.0.1:8000/furniture/default/results/sdfsafs
>>>>>>>> Works.
>>>>>>>> Any solution for this?
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Try putting the last part in a query string (vars) and see how that
>>>>>>> goes:
>>>>>>>
>>>>>>>
>>>>>>> http://127.0.0.1:8000/furniture/default/results?sdfsafsdfa%C3%A4%C3%A4%C3%A4
>>>>>>>
>>>>>>>> BR,
>>>>>>>> Jason Brower
>>>>>>>> On Wed, 2010-10-20 at 20:52 +0300, Jason Brower wrote:
>>>>>>>>> I can see it in google, I can use cär and it works...
>>>>>>>>> Why or how can I use äöå in that area or is there some other way to
>>>>>>>>> use it as a parameter when sending data to a page...
>>>>>>>>> BR,
>>>>>>>>> Jason Brower
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>
>