[Zope] Importing Unauthorized?

2011-11-11 Thread Brian R Brinegar

We're in the process of migrating from Zope 2.11 to Zope 2.13, we have scripts 
which raise string exceptions, which is no longer allowed by the version of 
python.

In particular, we have scripts which:

  raise Unauthorized

However, we don't seem to be able to import the Unauthorized exception from 
AccessControl or zExceptions. What is the new way to raise an Unauthorized 
exception from within a Zope Python Script?

Thanks,

Brian Brinegar
Web Services Coordinator
Engineering Computer Network

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


Re: [Zope] Importing Unauthorized?

2011-11-11 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1




from zExceptions import Unauthorized
raise Unauthorized

But this will only workin unrestricted code.
Turn your code to browser views if you can.

- -aj

Brian R Brinegar wrote:
 We're in the process of migrating from Zope 2.11 to Zope 2.13, we
 have scripts which raise string exceptions, which is no longer
 allowed by the version of python.
 
 In particular, we have scripts which:
 
 raise Unauthorized
 
 However, we don't seem to be able to import the Unauthorized
 exception from AccessControl or zExceptions. What is the new way to
 raise an Unauthorized exception from within a Zope Python Script?
 
 Thanks,
 
 Brian Brinegar Web Services Coordinator Engineering Computer Network
 
 ___ Zope maillist  -
 Zope@zope.org https://mail.zope.org/mailman/listinfo/zope **   No
 cross posts or HTML encoding!  ** (Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce 
 https://mail.zope.org/mailman/listinfo/zope-dev )

- -- 
ZOPYX Limited   | zopyx group
Charlottenstr. 37/1 | The full-service network for Zope  Plone
D-72070 Tübingen| Produce  Publish
www.zopyx.com   | www.produce-and-publish.com
- 
E-Publishing, Python, Zope  Plone development, Consulting


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJOvS7sAAoJEADcfz7u4AZjiswLwJy0ALr//lJTYX16icAw1a59
rt9iVpckw3gme/NJ295K2HUbnL5T51XBiBE+uTqZmRzK3xH77JCq3rO4G2vfniyu
gEMwxW/h2Wa+Rs2WxM5UtVq1vhI/hsymEDDm9xUMRsqfU95sAQOcvUqm0sKc8bJB
ff4QtXYvTW663u4SqW/v9RRDdukVowD77DCJqmDUQ/Js2iYSR+qPYIjOlfk4l29D
yfxDdG+kdHlBrJ96/1EoriNlLfF6OOVrYKM2i70BJSIlB9pmjusxJQ5dGFwN9ylj
O8DgBXmfqtj/u4ye24giGQyV/L4jfiU27LQX3fFP7lqf/yB7BeNwi1jkRSrvGFlU
eDPtarxVODybKgb6M1AKL5E8GGzslqnE9iZd11Y9o2zWgxvjE1dedO+Nicv6ybP5
hXfuKSsd+Jpy32bfCF13ZT3PV7pE+0w/SLccXdTI+WlQeVY3XnNqdLeFtxdIH7mh
wjLgUc+dDaBNtbb8TmTjhfUYngaMWb4=
=2WVA
-END PGP SIGNATURE-
attachment: lists.vcf___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )