Varun Parange wrote at 2005-6-2 10:34 -0700:
>i am having problems importing encode_base64
> 
>i have created a product in which i have specified:
>'''
>from AccessControl import allow_module, allow_class, allow_type
>from AccessControl import ModuleSecurityInfo, ClassSecurityInfo
>from email.Encoders import encode_base64
>
>allow_class(encode_base64)
> 
>''
> 
>however when i try using it:
> 
>from Products.EmailTools import 
>MIMEText,MIMEBase,MIMEMultipart,Header,encode_base64
>
>i get an error saying:
>
>Error Type: ImportError
>Error Value: cannot import name encode_base64

You use "allow_class" in the wrong way:

  "encode_base64" is not a class but a function.

  "allow_class" sets security declarations such that the
  attributes of instances of this class can be accessed
  without restrictions. However, there are no instances
  of a function...

What you almost surely want is:

     ModuleSecurityInfo('email.Encoders').declarePublic('encode_base64')

> ...
>---------------------------------
>Discover Yahoo!
> Have fun online with music videos, cool games, IM & more. Check it 
> out!<DIV>hi,</DIV>
><DIV>&nbsp;</DIV>

Please sent plain text only messages...


-- 
Dieter
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to