[Zope] Base64 - Encoding/Decoding without external method

robert robert at redcor.ch
Wed Feb 9 00:53:39 EST 2005


Andy Dustman wrote:

>On Mon, 7 Feb 2005 22:15:30 +0100, Lombardoni, Andrea
><lombardo at inf.ethz.ch> wrote:
>  
>
>>>>I would like to decode/encode data in base64 without resorting
>>>>to an external Python method.
>>>>        
>>>>
>>>The following is in the Python interpreter, but I have verified that
>>>it works for Python scripts in Zope.
>>>      
>>>
>>>>>"Hello World!".encode('base64')
>>>>>          
>>>>>
>>>>'SGVsbG8gV29ybGQh\n'
>>>>        
>>>>
>>>>>'SGVsbG8gV29ybGQh\n'.decode('base64')
>>>>>          
>>>>>
>>>>'Hello World!'
>>>>        
>>>>
>>>>>'Clguba ebpxf!'.decode('rot13')
>>>>>          
>>>>>
>>>>u'Python rocks!'
>>>>        
>>>>
>>I tried your suggestion, but it does not work in Zope.
>>
>>I createad a simple Script(Python) object like this:
>>
>>print 'ciao ciao'.encode('base64')
>>return printed
>>
>>But when I try to see it from Zope it returns this error:
>>
>>Error Type: SystemError
>>Error Value: module "encodings.base64" failed to register
>>    
>>
>
>Hmmm. I made a Script (Python) called decode with a parameter thing,
>and the code:
>
>return thing.decode('base64')
>  
>
I tried this and get an error
*Error Type: Error*
*Error Value: Incorrect padding

I am using Zope 2.74 Python 2.3.4 on linux

Robert
*


More information about the Zope mailing list