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

Kyler B. Laird laird@ecn.purdue.edu
Wed, 28 Feb 2001 15:18:22 -0500


>  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