[Product-Developers] Adding existing users to borg's IDepartment schema

Andrew Pasquale andrew at elytra.net
Thu Nov 20 12:03:33 UTC 2008


Hello,

I'm using Products.membrane and b-org to manage departments and employees,
but I'd like to be able to have employees belong to more than one
department.  I was thinking of trying to replicate the interface from
borg.project to be able to add existing users to borg departments as
employees.   

I'm new to Plone and Zope and I'm not sure I fully comprehend the
architecture of the schemas.  I'm trying to use the example "charity"
extension included with borg.  The schema from borg/project/interfaces.py
for IProject seems to be a different style from the borg charity schema.

from zope.interface import Interface
from zope import schema
from plone.app.vocabularies.users import UsersSource

class IProject(Interface):
<snip>    
    members = schema.List(title=_(u"Members"),
                          description=_(u"The following users should be
members of this project"),
                          value_type=schema.Choice(title=_(u"User id"),
                                                   source=UsersSource,),
                          required=False)

The schema interface from the charity extension (schema/department.py) looks
like this:

from Products.Archetypes.atapi import *
from Products.borg.interfaces import IDepartmentContent
from Products.borg.interfaces import ISchemaExtender

CharityDepartmentSchema = Schema((
    
    TextField('description',
        user_property=True,
        required=True,
        searchable=True,
        default_content_type='text/html',
        default_output_type = 'text/x-html-safe',
        allowable_content_types = ('text/html', 'text/structured',
'text/x-web-intelligent',),
        widget=RichWidget(
            label=u"Department description",
            description=u"Enter a description of the department",
        ),
    ),

It seems like I need to translate the first style of schema into the second,
but I haven't been able to figure out to do this.   Is there somewhere I can
find a tutorial that might cover this? 

Finally, if you have any ideas on other ways to achieve the goal of adding
existing users to departments, I'd love to hear about it.  Is there anything
obvious that I've overlooked?  

Thanks, Andrew
-- 
View this message in context: http://n2.nabble.com/Adding-existing-users-to-borg%27s-IDepartment-schema-tp1556840p1556840.html
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list