I am trying to figure out ZPatterns and because I rather work with Python Products 
when with Zclasses I am trying to convert the EmployZ product to Python.
So far I got half the way there, the Rack recognizes the DataSkin
And on newItem in the Specialist it a new slot gets created and I can see them and 
their ID.

Now the problem is creating a Propertysheet in the DataSkin that gets stored in the 

I packet my work so far and put it on Zope.org: 

I look at the ZPattern Products that I know are out there, but they don't seem 
help me any futher.


Here's my to classes:

< EmployX (DataSkin)>

__doc__ = """EmployX product module.

See README.txt for more details."""

__version__ = '0.0.1'

from Globals import HTMLFile
from Globals import MessageDialog
from Globals import Persistent

import OFS.SimpleItem
import Acquisition
import AccessControl.Role

from Products.ZPatterns.DataSkins import DataSkin
#from Products.ZPatterns.PropertySheets import VirtualSheets

manage_addEmployXForm = HTMLFile('dtml/EmployXAdd', globals()) 

def manage_addEmployX(self, id, title='', REQUEST=None):
    """Add a EmployX to a folder."""
    self._setObject(id, EmployX(id, title))
    if REQUEST is not None:
        return self.manage_main(self, REQUEST)

class EmployX(
    """EmployX object. 
    meta_type = 'EmployX'

    # Necessary?
    _isRackMountable = 1

    #             {'id':'first', 'type': 'string'},
    #             {'id':'last', 'type': 'string'},
    #             {'id':'emp_id', 'type': 'string'},
    #             {'id':'salary', 'type': 'string'},                 
    #            )
    manage_options = ( 
            {'label': 'Edit',       'action': 'manage_main' },
            {'label': 'View',       'action': 'index_html'}, 
            {'label': 'Security',   'action': 'manage_access'},

    _v_manage_options_label_index = 

                ('View management screens', ('debug','manage_tabs','manage_main')),
                ('Change permissions',      ('manage_access',)           ),
                ('Change EmployX'     ,     ('manage_edit',)             ),
                ('View EmployX',            ('',)                        ),

    def __init__(self,id): 
        """initialise a new instance of BeingBoring"""
    def debug(self):
        """ Print object's __dict__ """
        result = ""
        for k, v in self.__dict__.items():
            result = "%s\n%s : %s" % (result, repr(k), repr(v))
        return result

    manage_main = HTMLFile('dtml/EmployXEdit', globals()) 
    def manage_edit(self, title, REQUEST=None): 
        """does this really need a doc string?"""
        self.title = title
        if REQUEST is not None:
            return self.manage_main(self,REQUEST,management_view='Edit')

    editInstance = HTMLFile('editInstance', globals()) 
    editInstanceForm = HTMLFile('editInstanceForm', globals()) 
    index_html  = HTMLFile('index_html', globals()) 

def initialize(context): 
    """Initialize the EmployX product.

            constructors = (                 
            icon = 'www/item.gif'                
    # We need this so that this class will show up in the list of classes
    # Customizers can customize. (Thanks Steve)

< EmployXManager(Specialist)>

__doc__ = """EmployXManager product module.

See README.txt for more details."""

__version__ = '0.0.1'

from Globals import HTMLFile
#from Globals import MessageDialog
#from Globals import Persistent

from Products.ZPatterns.Specialists import Specialist

manage_addEmployXManagerForm = HTMLFile('EmployXManagerAdd', globals()) 

def manage_addEmployXManager(self, id, title='', REQUEST=None):
    """Add a EmployXManager to a folder."""
    self._setObject(id, EmployXManager(id, title))
    if REQUEST is not None:
        return self.manage_main(self, REQUEST)

class EmployXManager(Specialist):
    """Thing that manages EmployX"""
    meta_type = "EmployXManager" 

    newItemForm = HTMLFile('newItemForm', globals()) 
    index_html  = HTMLFile('index_html_manager', globals()) 

    def addNewItem(self,emp_id,REQUEST=None):
        ob = self.newItem(emp_id)
        #if REQUEST.has_key('first'): ob.first = REQUEST['first']
        #else:  ob.first = ''
        #if REQUEST.has_key('last'): ob.last = REQUEST['last']
        #else:  ob.last = ''
        #if REQUEST.has_key('emp_id'): ob.emp_id = REQUEST['emp_id']
        #else:  ob.emp_id = ''
        #if REQUEST.has_key('salary'): ob.salary = REQUEST['salary']
        #else:  ob.salary = ''
        if REQUEST is not None:
            return self.manage_main(self, REQUEST)

def initialize(context): 
    """Initialize the EmployXManager product.

            constructors = (                 
            icon = 'www/item.gif'                

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to