[Zope-dev] Zope Cookie Handling

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 17 Mar 2000 07:41:23 +0000


On Thu, 16 Mar 2000 17:19:40 -0500, "Pearson, Brian Edward (GEA,
056278)" <BRIAN.PEARSON@APPL.GE.COM> wrote:

<snip problem details>

>> A colleague of mine pointed out that Zope was returning the values in
>> Octal rather than decimal.
>> 
>> Is this behavior by design?

You tell us - your code is performing the conversion ;-)

>> Is there another mechanism I can use to
>> retrieve the raw cookie value before Zope places it in a dictionary?

>>         cookie = REQUEST.get('cookie')

You had the raw cookie in the string variable called 'cookie' at this
point in your source. The next line creates the octal. 

>>         cookie = repr(cookie)

The entry in the python manual for the repr function says....

<quote>
Return a string containing a printable representation of an object.
This is the same value yielded by conversions (reverse quotes). It is
sometimes useful to be able to access this operation as an ordinary
function. For many types, this function makes an attempt to return a
string that would yield an object with the same value when passed
</quote>

Python 1.5.2 (#0, Oct 11 1999, 09:59:20) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> print 'hello world'
hello world
>>> print repr('hello world\n')
'hello world\012'                        * notice the quotes and octal
>>>

Hope this helps,


Toby Dickenson
tdickenson@geminidataloggers.com