[Zope] how to decode base64 in DTML?
Jaroslav Lukesh
lukesh at seznam.cz
Thu May 4 15:45:46 EDT 2006
> bounces+lsh=wo.cz at zope.org] On Behalf Of Igor Stroh
>
> Jaroslav Lukesh wrote:
>
> > import cStringIO
> > import mimetools
> > import binascii
>
> [...]
>
>
> <dtml-var "'YWxla2liYW5nb0B6dWcuY3o=\n'.decode('base64')">
Thank you - it is exact what I need, but it does not have rights to make
that conversion - see bottom. So only way is now to add this rights into
dtml - via external method only, because in Python script it gives me the
same guard error.
Parameter:xemail
import cStringIO
import mimetools
xe=xemail + '=\n'
print xe.decode('base64')
return printed
Thanks, many thanks, I was little to learn how to use python scripts in zope
:o)
So I dive into external method.
Many thanks,JL.
Error from DTML:
<P><STRONG>AttributeError</STRONG></P>
Sorry, a site error occurred.<p>
<!--
Traceback (innermost last):
File D:\zope\251\lib\python\ZPublisher\Publish.py, line 150, in
publish_module
File D:\zope\251\lib\python\ZPublisher\Publish.py, line 114, in publish
File D:\zope\251\lib\python\Zope\__init__.py, line 159, in
zpublisher_exception_hook
(Object: zzzkusebni)
File D:\zope\251\lib\python\ZPublisher\Publish.py, line 98, in publish
File D:\zope\251\lib\python\ZPublisher\mapply.py, line 88, in mapply
(Object: test)
File D:\zope\251\lib\python\ZPublisher\Publish.py, line 39, in call_object
(Object: test)
File D:\zope\251\lib\python\OFS\DTMLMethod.py, line 127, in __call__
(Object: test)
File D:\zope\251\lib\python\DocumentTemplate\DT_String.py, line 473, in
__call__
(Object: test)
File D:\zope\251\lib\python\DocumentTemplate\DT_Util.py, line 159, in eval
(Object: 'YWxla2liYW5nb0B6dWcuY3o=\n'.decode('base64'))
File <string>, line 1, in f
File D:\zope\251\lib\python\AccessControl\DTML.py, line 29, in
guarded_getattr
(Object: test)
File D:\zope\251\lib\python\AccessControl\ZopeGuards.py, line 47, in
guarded_getattr
AttributeError: decode
More information about the Zope
mailing list