[zopeorg-checkins] CVS: Products/PortalBase - CHANGES.txt:1.1 Documents.py:1.1 MemberFolder.gif:1.1 MemberFolder.py:1.1 MemberFolder.py.old:1.1 MemberFolder.py2:1.1 Membership.py:1.1 User.gif:1.1 ZopeSite.py:1.1 __init__.py:1.1

Sidnei da Silva sidnei at x3ng.com.br
Fri May 30 11:17:45 EDT 2003


Update of /cvs-zopeorg/Products/PortalBase
In directory cvs.zope.org:/tmp/cvs-serv19195/PortalBase

Added Files:
	CHANGES.txt Documents.py MemberFolder.gif MemberFolder.py 
	MemberFolder.py.old MemberFolder.py2 Membership.py User.gif 
	ZopeSite.py __init__.py 
Log Message:
Adding products needed for migration of NZO

=== Added File Products/PortalBase/CHANGES.txt ===
PortalBase Changes

  PortalBase 1.0.0

    Initial release


=== Added File Products/PortalBase/Documents.py ===
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################

"""Enhanced document object base classes"""
__version__='$Revision: 1.1 $'[11:-2]

from ComputedAttribute import ComputedAttribute
from DocumentTemplate.DT_String import String
from OFS.DTMLDocument import DTMLDocument
from OFS.DTMLMethod import DTMLMethod
from ExtensionClass import Base
import Globals




class DocumentHooks(Base):
    """ """

    def __get_name__(self):
        return getattr(self, '__name__')

    id=ComputedAttribute(__get_name__)

    def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='50',
                    dtpref_rows='20',REQUEST=None):
        """ """
        self.onEditBegin()
        r=DTMLMethod.manage_edit(self, data, title, SUBMIT=SUBMIT,
                                 dtpref_cols=dtpref_cols,
                                 dtpref_rows=dtpref_rows,
                                 REQUEST=REQUEST)
        self.onEditComplete()
        return r

    def manage_upload(self,file='', REQUEST=None):
        """ """
        self.onEditBegin()
        r=DTMLMethod.manage_upload(self, file, REQUEST)
        self.onEditComplete()
        return r

    def PUT(self, REQUEST, RESPONSE):
        """ """
        self.onEditBegin()
        r=DTMLMethod.PUT(self, REQUEST, RESPONSE)
        self.onEditComplete()
        return r

    def onEditBegin(self):
        """ """
        pass

    def onEditComplete(self):
        """ """
        pass


class HTMLDocument(DocumentHooks, DTMLDocument):
    """ """

    _state_name={'raw':1, 'globals':1, '__name__':1, '_vars':1,
                 '_proxy_roles':1,
                 'title':1,
                 'subject':1,
                 'description':1,
                 'date':1,
                 'content':1,
                 'reviewed':1,
                 }.has_key


class HTMLMethod(DocumentHooks, DTMLMethod):
    """ """
    _state_name={'raw':1, 'globals':1, '__name__':1, '_vars':1,
                 '_proxy_roles':1,
                 'title':1,
                 'subject':1,
                 'description':1,
                 'date':1,
                 'content':1,
                 'reviewed':1,
                 }.has_key



Globals.default__class_init__(HTMLDocument)
Globals.default__class_init__(HTMLMethod)


=== Added File Products/PortalBase/MemberFolder.gif ===
  <Binary-ish file>

=== Added File Products/PortalBase/MemberFolder.py === (449/549 lines abridged)
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment

[-=- -=- -=- 449 lines omitted -=- -=- -=-]


_login_html="""<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<p>
<form action="<!--#var SCRIPT_NAME--><!--#var PATH_INFO--><!--#if
 QUERY_STRING-->?<!--#var QUERY_STRING--><!--#/if-->" method="POST">
<table>
<tr>
  <td align="left" valign="top">
  <strong>Name</strong>
  </td>
  <td align="left" valign="top">
  <input type="TEXT" name="__ac_name" size="20">
  </td>
</tr>
<tr>
  <td align="left" valign="top">
  <strong>Password</strong>
  </td>
  <td align="left" valign="top">
  <input type="PASSWORD" name="__ac_password" size="20">
  </td>
</tr>
<tr>
  <td align="left" valign="top">
  </td>
  <td align="left" valign="top">
  <input type="SUBMIT" name="submit" value=" Ok ">
  </td>
</tr>
</table>
</form>
</body>
</html>"""


_logout_html="""<html>
<head>
<title>Logout</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<p>
<center>
You have been logged out of the system.
</center>
</body>
</html>"""


=== Added File Products/PortalBase/MemberFolder.py.old === (422/522 lines abridged)
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment

[-=- -=- -=- 422 lines omitted -=- -=- -=-]


_login_html="""<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<p>
<form action="<!--#var SCRIPT_NAME--><!--#var PATH_INFO--><!--#if
 QUERY_STRING-->?<!--#var QUERY_STRING--><!--#/if-->" method="POST">
<table>
<tr>
  <td align="left" valign="top">
  <strong>Name</strong>
  </td>
  <td align="left" valign="top">
  <input type="TEXT" name="__ac_name" size="20">
  </td>
</tr>
<tr>
  <td align="left" valign="top">
  <strong>Password</strong>
  </td>
  <td align="left" valign="top">
  <input type="PASSWORD" name="__ac_password" size="20">
  </td>
</tr>
<tr>
  <td align="left" valign="top">
  </td>
  <td align="left" valign="top">
  <input type="SUBMIT" name="submit" value=" Ok ">
  </td>
</tr>
</table>
</form>
</body>
</html>"""


_logout_html="""<html>
<head>
<title>Logout</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<p>
<center>
You have been logged out of the system.
</center>
</body>
</html>"""


=== Added File Products/PortalBase/MemberFolder.py2 === (433/533 lines abridged)
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment

[-=- -=- -=- 433 lines omitted -=- -=- -=-]


_login_html="""<html>
<head>
<title>Login</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<p>
<form action="<!--#var SCRIPT_NAME--><!--#var PATH_INFO--><!--#if
 QUERY_STRING-->?<!--#var QUERY_STRING--><!--#/if-->" method="POST">
<table>
<tr>
  <td align="left" valign="top">
  <strong>Name</strong>
  </td>
  <td align="left" valign="top">
  <input type="TEXT" name="__ac_name" size="20">
  </td>
</tr>
<tr>
  <td align="left" valign="top">
  <strong>Password</strong>
  </td>
  <td align="left" valign="top">
  <input type="PASSWORD" name="__ac_password" size="20">
  </td>
</tr>
<tr>
  <td align="left" valign="top">
  </td>
  <td align="left" valign="top">
  <input type="SUBMIT" name="submit" value=" Ok ">
  </td>
</tr>
</table>
</form>
</body>
</html>"""


_logout_html="""<html>
<head>
<title>Logout</title>
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<p>
<center>
You have been logged out of the system.
</center>
</body>
</html>"""


=== Added File Products/PortalBase/Membership.py ===
# This module implements various external methods used
# by our Membership and registration objects.


import sys, os, string, time, random
from DateTime import DateTime




# Registration methods
# --------------------


def added_props(self):
    """ """
    stdprops=('name','email','last_visit','prev_visit','full_name','company')
    c=self.Control_Panel.Products.ZopeSite.MemberFolder
    c=c.propertysheets.methods._getOb('Member')
    ps=c.propertysheets.common.CommonProperties
    ids=ps.propertyIds()
    set=[]
    for id in ids:
        if not (id in stdprops):
            set.append(id)
    return set

chars=string.letters+string.digits
def gen_password(choose=random.choice, chars=chars, join=string.join):
    result=[]
    for n in range(8):
        result.append(choose(chars))
    return join(result, '')
    

def register(self, username='', fullname='', company='', email='',
             REQUEST=None):
    """ """
    register_html=getattr(self, 'register.html')
    if not username or not email:
        return register_html(self, REQUEST,
               error='You must enter a value for Name and a valid Email ' \
                     'Address.')

    user=self.acl_users.getUser(username)
    if user is not None:
        return register_html(self, REQUEST,
               error='The login name you selected is already in use. Please ' \
                     'choose another.')
    password=gen_password()

    # Add the member

    self.acl_users.addUser(username, password, ['Member'], [])

    user=self.acl_users.getUser(username)
    for ps in user.propertysheets:
        ps.manage_changeProperties(REQUEST)
    
    # Here we add a new Folder for this user in Members,
    # giving the user the local role 'Owner' in his Folder.
    members=self.Members
    members.manage_addFolder(username)
    folder=getattr(members, username)
    if REQUEST:
        name=REQUEST['AUTHENTICATED_USER'].getUserName()
        folder.manage_delLocalRoles([name])
    folder.manage_setLocalRoles(username, ['Owner'])
    
    # Generate email notification
    self.notify(self, REQUEST, password=password)

    return getattr(self, 'success.html')(self, REQUEST)


def updateMember(self, REQUEST):
    """ """
    user=REQUEST['AUTHENTICATED_USER']
    name=user.getUserName()
    if hasattr(user, 'propertysheets'):
        for ps in user.propertysheets:
            ps.manage_changeProperties(REQUEST)
        return self.index_html(self, REQUEST,
                               message='Your changes have been saved.')
    else:
        return self.index_html(self, REQUEST,
                               message='Cannot set non-member %s' % user)

# MemberFolder methods
# --------------------


def fixup_user(user):
    if hasattr(user, 'last_visit'):
        if not user.last_visit.isCurrentDay():
            user.prev_visit=user.last_visit
            user.last_visit=DateTime().earliestTime()
    return user

def addMemberFolder(self, REQUEST=None):
    if hasattr(self.aq_base, 'acl_users'):
        return MessageDialog(
               title  ='Item Exists',
               message='This object already contains a User Folder',
               action ='%s/manage_main' % REQUEST['URL1'])
    dest=self.Destination()
    ob=self.MemberFolder() #'acl_users', REQUEST)
    dest._setObject('acl_users', ob)
    dest.__allow_groups__=dest.acl_users
    if REQUEST: return dest.manage_main(dest, REQUEST, update_menu=1)


def addUser(self, name, password, roles, domains, REQUEST=None):
    """ """
#    zclass=self.Control_Panel.Products.ZopeSite.MemberFolder.Member._zclass_
    user=self.Member(name, password, roles, domains)
    user.id=name
    self.data[name]=user    
    if REQUEST is not None:
        return self.manage_main(self, REQUEST=REQUEST)

def getUser(self, name):
    """ """
    if self.data.has_key(name):
        user=self.data[name].__of__(self)
        user=fixup_user(user)
        return user
    return None

def changeUser_Form(self, name, REQUEST=None):
    """ """
    user=self.data[name].__of__(self)
    return self.changeUserForm(self, REQUEST=REQUEST, user=user,
                               password=user._getPassword())

def changeUser(self, name, password, roles, domains, REQUEST=None):
    """ """
    user=self.data[name]
    user._pw_=password
    user.roles=roles
    user.domains=domains
    if REQUEST is not None:
        return self.manage_main(self, REQUEST=REQUEST)

def changeUserPassword(self, name, password, domains, REQUEST=None):
    """ """
    user=self.data[name]
    user._pw_=password
    user.domains=domains
    if REQUEST is not None:
        return self.manage_main(self, REQUEST=REQUEST)

        
def delUser(self, names, REQUEST=None):
    """ """
    # Delete and clean up after a user
    members=self.Members
    for name in names:
        if self.data.has_key(name):
            del self.data[name]
        if hasattr(members.aq_base, name):
            members._delObject(name)
    if REQUEST is not None:
        return self.manage_main(self, REQUEST=REQUEST)


=== Added File Products/PortalBase/User.gif ===
  <Binary-ish file>

=== Added File Products/PortalBase/ZopeSite.py ===
import sys, os, string, time, random
from DateTime import DateTime



def getOwners(self, join=string.join):
    dict=self.__ac_local_roles__ or {}
    list=[]
    for key, val in dict.items():
        if 'Owner' in val:
            list.append(key)
    return join(list, ', ')



def approveNewsItem(self, REQUEST=None):
    """ """
    for ps in self.propertysheets.values():
        ps.manage_changeProperties(REQUEST=REQUEST)
    # Add to catalog here...
    
    self.title=title


def ReturnFindableAttributes(self):
    """ Should be bound to an objects 'ZopeCatalogAttributes' method
    """
    fas = ()

    for x in self.__class__.__bases__:
        if hasattr(x, 'findableAttributes'):
            if x.findableAttributes:
                for i  in x.findableAttributes:
                    (n, a, t, i) = string.split(i)
                    fas.append({'name' : n, 'attr' : a, 'type' : t, 
                                'index' : i})

    if self.findableAttributes:
        for i in self.findableAttributes:
            (n, a, t, i) = string.split(i)
            fas.append({'name' : n, 'attr' : a, 'type' : t, 'index' : i})

    return fas



def DelObjects(self, ids, REQUEST):
    """ Deletes an list of objects from the catalog
    """
    urls = []

    for n in ids:
        urls.append(getattr(self, n).absolute_url())
    self.Catalog.manage_catalogRemove(urls=urls)

    self.manage_delObjects(ids)
    return self.manage_main(self, REQUEST)





# Registration methods
# --------------------

chars=string.letters+string.digits
def gen_password(choose=random.choice, chars=chars, join=string.join):
    result=[]
    for n in range(8):
        result.append(choose(chars))
    return join(result, '')
    

def register(self, username='', fullname='', company='', email='',
             REQUEST=None):
    """ """
    register_html=getattr(self, 'register.html')
    if not username or not email:
        return register_html(self, REQUEST,
               error='You must enter a value for Name and a valid Email ' \
                     'Address.')

    user=self.acl_users.getUser(username)
    if user is not None:
        return register_html(self, REQUEST,
               error='The login name you selected is already in use. Please ' \
                     'choose another.')
    password=gen_password()

    # Add the member
    self.acl_users.addUser(username, password, ['Member'], [])
    
    # Here we add a new Folder for this user in Members,
    # giving the user the local role 'Owner' in his Folder.
    members=self.Members
    members.manage_addFolder(username)
    folder=getattr(members, username)
    folder.manage_setLocalRoles(username, ['Owner'])    

    # Generate email notification
    self.notify(self, REQUEST, password=password)

    return getattr(self, 'success.html')(self, REQUEST)




# MemberFolder methods
# --------------------


def fixup_user(user):
    if hasattr(user, 'last_visit'):
        if not user.last_visit.isCurrentDay():
            user.last_visit=DateTime().earliestTime()
    return user

def addMemberFolder(self, REQUEST=None):
    if hasattr(self.aq_base, 'acl_users'):
        return MessageDialog(
               title  ='Item Exists',
               message='This object already contains a User Folder',
               action ='%s/manage_main' % REQUEST['URL1'])
    dest=self.Destination()
    __traceback_info__=(hasattr(dest.aq_base, 'acl_users'),)
    ob=self.MemberFolder('acl_users', REQUEST)
    dest.__allow_groups__=dest.acl_users
    if REQUEST: return dest.manage_main(dest, REQUEST, update_menu=1)


def addUser(self, name, password, roles, domains, REQUEST=None):
    """ """
    zclass=self.Control_Panel.Products.ZopeSite.MemberFolder.Member._zclass_
    user=zclass(name, password, roles, domains)
    user.id=name
    self.data[name]=user

    # Here we add a new Folder for this user in Members,
    # giving the user the local role 'Owner' in his Folder.
    members=self.Members
    members.manage_addFolder(name)
    folder=getattr(members, name)
    if REQUEST is not None:
        user=REQUEST.get('AUTHENTICATED_USER', None)
        if user is not None:
            folder.manage_delLocalRoles([user.getUserName()])
    folder.manage_setLocalRoles(name, ['Owner'])    
    
    if REQUEST is not None:
        return self.manage_main(self, REQUEST=REQUEST)

def getUser(self, name):
    """ """
    if self.data.has_key(name):
        user=self.data[name].__of__(self)
        user=fixup_user(user)
        return user
    return None

def changeUser_Form(self, name, REQUEST=None):
    """ """
    user=self.data[name].__of__(self)
    return self.changeUserForm(self, REQUEST=REQUEST, user=user,
                               password=user._getPassword())

def changeUser(self, name, password, roles, domains, REQUEST=None):
    """ """
    user=self.data[name]
    user.__=password
    user.roles=roles
    user.domains=domains
    if REQUEST is not None:
        return self.manage_main(self, REQUEST=REQUEST)
        
def delUser(self, names, REQUEST=None):
    """ """
    # Delete and clean up after a user
    members=self.Members
    for name in names:
        if self.data.has_key(name):
            del self.data[name]
        if hasattr(members.aq_base, name):
            members._delObject(name)
            if REQUEST is not None:
                return self.manage_main(self, REQUEST=REQUEST)


=== Added File Products/PortalBase/__init__.py ===
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################
"""Portal services base objects"""
__version__='$Revision: 1.1 $'[11:-2]

from ImageFile import ImageFile
import MemberFolder, Documents


# This is the new way to initialize products.  It is hoped
# that this more direct mechanism will be more understandable.
def initialize(context):

##     perm='Add Member Folder'

##     context.registerClass(
##         MemberFolder.MemberFolder,
##         permission=perm,
##         constructors=(MemberFolder.addForm, Membership.add,),
##         icon='MemberFolder.gif',
##         )

    context.registerBaseClass(MemberFolder.MemberFolder)
    context.registerBaseClass(MemberFolder.Member)
    context.registerBaseClass(Documents.HTMLDocument, 'HTML Document')
    context.registerBaseClass(Documents.HTMLMethod, 'HTML Method')


    
#    context.registerBaseClass(AccessControl.User.User)
#    context.registerZClass(ZClasses.ObjectManager.ZObjectManager)
                           



## __ac_permissions__=(
##     ('Add Subscription Dbs', ('manage_addSubscriptionDbForm',
##                               'manage_addSubscriptionDb')),
##     ('Change Subscription Dbs', ()),
##     )





More information about the zopeorg-checkins mailing list