[z3-five] Adaptation in untrusted code
Tres Seaver
tseaver at palladion.com
Fri Nov 17 03:38:12 CET 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Maciej Wisniowski wrote:
> I have written simple adapter for RAMCacheManager that allows me
> to flush individual cache entries. It would be nice if I'll be able
> to call from one Script (Python) something like:
>
> from Products.RAMCacheManagerPlus.interfaces import ICacheablePlus
> ICacheablePlus(context.secScript).invalidate(
> keywords_req={'AUTHENTICATED_USER':request.AUTHENTICATED_USER}
> partial = 1)
>
>
> where ICacheablePlus is my adapter and
> context.secScript is Script(Python) with caching enabled.
>
> It works from external methods and Products, but not from the
> 'content space'.
What error results from trying that inside a Python Script? Even
better, write up a unit test which:
- Registers an adapter using the syntax you expect (might be a
"dummy" version)
- Creates and invokes a Python Script with an instance for which
the adapter lookup should succeed.
- Asserts that the result of calling your method on the adapter
is what you expect.
Write it as either a "classic" unit test or as a doctest narrative, and
then we can all run it and see what happens.
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFXSCU+gerLs4ltQ4RAjMAAKC3Cb5WxsNOpmEVwqRrkg1/dLqsOACePJZ2
iQxtv1oSqAGgjbZpA8VwvP4=
=ZtVf
-----END PGP SIGNATURE-----
More information about the z3-five
mailing list