[Zope] ZSQL method and database connection acquisition.
Dieter Maurer
dieter@handshake.de
Mon, 3 Sep 2001 23:36:47 +0200 (CEST)
jon@totient.demon.co.uk writes:
> any chance you could be more explicit.
You read the ZClass chapter in the Zope book?
> This has confused me enough already
>
> it's "Use Database Methods" permission?
>
> do you add this on the Product Folder, the Zclass thing or the
> instance? or on the zsqlmethod.
The ZClass allows you to remap the permissions protecting
the ZClass' methods.
Say, such a method is protected by "Use database methods".
But the ZClass uses the method to update a shopping card
and wants the permission to be "Update shopping card".
It can use a permission mapping to rebind the
"Use database methods" as necessary.
The context of the ZInstance can then associate roles
with the mapping target as required.
> should it be set to 'view' or 'use database methods'?
Whatever is more appropriate for the use of your Z SQL method....
E.g. when the SQL is just a search (no modification)
quite restrictive (can read only non-sensible information),
then "View" may be sufficient. If, however, it can
modify data, "Use database methods" would be more appropriate.
> does the open database connections come into use at all?
Only, when you want to test your Z SQL methods inside
the ZClass.
> this is driving me crazy. it should be so simple.
It is not too difficult.
Look at the chapter on ZClasses in the Zope Book.
When I last read it, it was quite understandable.
> (I've never liked the zope permission thing... and the language is terrible
> 'permission that requires this permission')
Seems to be a documentation bug:
means "operation requires a permission..."
or "permission is mapped to permission..."
Dieter