[Zope-CMF] Still having problems with tool creation...

Dmitry S. Makovey dmitry@athabascau.ca
Thu, 17 Jul 2003 12:36:06 -0600


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Posted this before but no answer so far... I'm having problem with cr=
eation of=20
tool for the portal (currently plone). I followed the reciepie:=20
http://plone.org/documentation/howto/HowToCreateATool

getting this:
=2E...
 Module Products.PageTemplates.TALES, line 220, in evaluate
   - Line 58, Column 13
   - Expression: <PythonExpr field.Vocabulary(here)>
   - Names:
      {'container': <PloneSite instance at a9697c0>,
       'default': <Products.PageTemplates.TALES.Default instance at=
=20
0x88751ec>,
       'here': <Course instance at a928640>,
       'loop': <SafeMapping instance at a9eb160>,
       'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleI=
mporter=20
instance at 0x87cb02c>,
       'nothing': None,
       'options': {'args': ()},
       'repeat': <SafeMapping instance at a9eb160>,
       'request': <HTTPRequest,=20
URL=3Dhttp://localhost:8080/w/comp_courses/Course.2003-07-17.0937/por=
tal_form/base_edit>,
       'root': <Application instance at a9038c0>,
       'template': <FSPageTemplate at /w/base_edit used for=20
/w/comp_courses/Course.2003-07-17.0937>,
       'traverse_subpath': [],
       'user': dimon}
  Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
   - __traceback_info__: field.Vocabulary(here)
  Module Python expression "field.Vocabulary(here)", line 2, in f
  Module Products.Archetypes.Field, line 115, in Vocabulary
  Module Products.CMFSyllabus.Course, line 73, in getCreditWeights
AttributeError: getList

Any ideas what I'm doing wrong?

Versions:
Zope-2.6.1, CMF-1.4, Plone-1.1a2, Archetypes-0.99.1

Snippets from source code:

<SyllabusTool.py>
=66rom Products.CMFCore.utils import UniqueObject
=66rom OFS.SimpleItem import SimpleItem
=66rom OFS.PropertyManager import PropertyManager
=66rom Globals import InitializeClass

=66rom Products.Archetypes.utils import DisplayList

# from AccessControl import ClassSecurityInfo

class SyllabusTool (UniqueObject, SimpleItem, PropertyManager):
=09""" Syllabus tool controls vocabularies for all containers """
=09id =3D "syllabus_tool"
=09meta_type =3D 'Syllabus Tool'
=09plone_tool =3D 1

#=09security=3DClassSecurityInfo()

=09manage_options=3D(({'label':'Properties', 'action': 'manage_proper=
tiesForm'},))

# =09security.declarePublic('getList')
=09def getList(self,list_name):
=09=09  return None

InitializeClass(SyllabusTool)
</SyllabusTool.py>

(tried also to uncomment lines with security settings with 0 success)

<Course.py>
=2E..
    def getCreditWeights(self):
        syllabus_tool=3DgetToolByName(self,self.syllabus_tool_name)
=09return syllabus_tool.getList('credit_weights')
=2E..
</Course.py>

In case if it matters:

<Extensions/Install.py>
=2E..
    tool_name=3D'syllabus_tool'

    print >> out, 'Installing %s...' % (tool_name)

    if hasattr(self, tool_name):
        print >> out, 'Found old one, deleting it...'
        self.manage_delObjects([tool_name])
        print >> out, 'deleted...'
    addTool =3D self.manage_addProduct['CMFSyllabus'].manage_addTool
    addTool('Syllabus Tool')
    st=3DgetToolByName(self,tool_name)
    st.manage_addProperty('credit_weights',('',),'lines')
    st.manage_addProperty('areas_of_studies',('',),'lines')
    st.manage_addProperty('methods_of_delivery',('',),'lines')
    st.manage_addProperty('u_centres',('',),'lines')
    print >> out, 'done.<br>\n'
=2E..
</Extensions/Instal.py>



- --=20
Dmitry Makovey
Web Systems Administrator
Athabasca University
(780) 675-6245
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE/FuyWyDrVuGfS98QRArIGAJ4z4fltu6krVoE2WlANIBtd32n2aQCgwnU1
Gv9JRO7Ma6BI+F/TEGwGw4o=3D
=3DJxKL
-----END PGP SIGNATURE-----