[Zope] Re: manage_addProperty problem.... workaround....

Steve Spicklemire steve@estel.uindy.edu
Sat, 27 Feb 1999 12:27:35 -0500 (EST)


>>>>> "Steve" == Steve Spicklemire <steve> writes:

    Steve> Hi Folks,

    Steve> [Problem with manage_addProperty deleted...]


OK .. I've make an obvious workaround to my problem with manage_addProperty

    Steve> So it's something to do with my setting a property of a folder... I check my code

the original code.... in manage_addEMarket():

      newMainF = EMarket()  # EMarket is a subclass of folder.....
      newMainF.id = id
      newMainF.title = title
      newMainF.manage_addProperty( 'RegistrationSubject', "Registration Information", 'string')
      newMainF.manage_addProperty( 'RegistrationFrom', "manager@" + gethostname(), 'string')

      self._setObject(id, newMainF)


This broke because for some reasy the EMarket instance didn't have an aq_base
defined until later (I could add the property by hand later and it was OK.)


to keep working I changed the EMarket class to be:

----------------------------------------------------------------------

class EMarket(OFS.Folder.Folder):

    """An EMarket class.

    Provide the functions needed to contain an online shopping area.
    """

    # Specify a name for the item type:
    meta_type='EMarket'
    id       ='emarket'
    title    ='EMarket Object'
    icon     ='misc_/EMarket/emarket'
    RegistrationSubject = 'Registration Information'
    RegistrationFrom = 'manager@' + defaulthost

    _properties=({'id':'title', 'type': 'string', 'mode':'w'},
                 {'id':'RegistrationSubject',
                  'type':'string',
                  'mode':'w'},
                 {'id':'RegistrationFrom',
                  'type':'string',
                  'mode':'w'},
                 )


----------------------------------------------------------------------

Not quite as obvious... but at least it works with 1.10.2!

I'll post the whole spiel soon...

-steve