[Zope] Why require "Manager" for changing Z SQL Method?

Matthew T. Kromer matt@digicool.com
Wed, 28 Feb 2001 20:34:30 -0500


Thanks Kyler; the DCO2 problem has to do with the fact that DCO1's Connect()
call is a method, whereas DCO2 it is a function -- so ZOracleDA makes a
method call, and the connect() function's arguments are all shifted over.
I'm going to change this RSN :)


----- Original Message -----
From: "Kyler B. Laird" <laird@ecn.purdue.edu>
To: "Dieter Maurer" <dieter@handshake.de>
Cc: <zope@zope.org>; <cameron@lairds.com>; <matt@digicool.com>
Sent: Wednesday, February 28, 2001 3:18 PM
Subject: Re: [Zope] Why require "Manager" for changing Z SQL Method?


>
> >  while "manage_edit" correctly follows the "Change Database" permission,
> >  "manage_main" is fixed to "Manager" while it should depend
> >  on "View Management screens".
> >
> >I do not yet know, why this is the case. Maybe,
> >DTMLFile objects define a "__roles__" attribute with
> >role "Manager".
>
> Ah ha!  I got it!
>
> [Realize that I am a Zope Dummy.  Really.  I should
> not be allowed to touch the code with this little
> knowledge of it.  I love that I can make things
> work, though!]
>
> The solution to this is to add
> __ac_permissions__=( ('Change Database Methods', ('manage_main',
'manage_edit')))
> to SQL.py.
>
> *Poof*!  That fixes it.
>
> Also, I've been asked for my kludge to make DCOracle2
> connect.  The code for connection() follows.  I do not
> suggest it as a fix.  Obviously the author had some
> much more complex things in mind when he wrote it.
> It did get me running, though.
>
> Thanks for the help!
>
> --kyler
>
>
> DCOracle2.py
> ===================
> def connect(dsn=None, user=None, password=None, database=None):
>
>     """Connect to Oracle.  The default argument is the dsn 'connection
string'
>     e.g. connect("scott/tiger@orac") but each parameter may also be
>     specified, e.g. connect(user="scott", password="tiger",
database="orac")."""
>
>     if dsn is not None:
>         dsn = dsn.connection
>         try:
>             userpass, dbname = split(dsn,"@")
>         except ValueError:
>             userpass = dsn
>             dbname = ""
>     else:
>         userpass = dsn
>         dbname = ""
>
>     if userpass is not None:
>         try:
>             (u, p) = split(userpass,"/")
>         except ValueError:
>             u = dsn
>             p = ""
>     else:
>         u = dsn
>         p = ""
>
>     if dsn is None: u = ""
>     #if user is not None: u = user
>     if password is not None: p = password
>     if database is not None: dbname = database
>
>     db = dco2.connect(u, p, dbname)
>     conn= connection(db)
>     return conn
>
>