[Product-Developers] Need Help Diagnosing an Error Message

Mark Phillips mark at phillipsmarketing.biz
Wed Dec 19 00:30:47 UTC 2007


I am using 
Plone 2.5.2, 
CMF-1.6.4, 
Zope (Zope 2.9.7-final, python 2.4.4, linux2), 
Five 1.4.2, 
Python 2.4.4 (#2, Aug 16 2007, 02:03:40) [GCC 4.1.3 20070812
(prerelease) (Debian 4.1.2-15)], 
PIL 1.1.6
membrane 1.0
remember 1.0b1

I have the following code in my ahsremember.py product (see attached
file). I am following the sampleremember product.

    atapi.TextField(
            'PrivacyPolicy',
            widget=atapi.TextAreaWidget(
                label='The privacy policy for this site',
                description='The privacy policy for this site',
                rows='10',
                cols='40'),
            regfield=1,
            required=True,
            #mode='r',
            default_content_type='text/html',
            accessor="PrivacyPolicy",
                ),
 and

    security.declarePublic('getPrivacyPolicy')
    def getPrivacyPolicy(self):
        policy = "The privacy policy......"
        return policy

If I comment out the accessor="PrivacyPolicy" in the TextField
definition above, there is no error and the text field is displayed.
However, as written, I get the following error. I must be making a basic
archetypes usage error, but I cannot find any documentation to figure it
out. The error message are not much help to me. 

Thanks for any suggestions you may have.

Mark



2007-12-18 17:18:48 ERROR Plone  
Traceback (most recent call last):
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFPlone/FactoryTool.py",
line 147, in __getitem__
    self.invokeFactory(id=id, type_name=type_name)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFPlone/PloneFolder.py",
line 406, in invokeFactory
    new_id = pt.constructContent(*args, **kw)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFCore/TypesTool.py",
line 934, in constructContent
    ob = info.constructInstance(container, id, *args, **kw)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFCore/TypesTool.py",
line 343, in constructInstance
    ob = self._constructInstance(container, id, *args, **kw)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFCore/TypesTool.py",
line 574, in _constructInstance
    newid = m(id, *args, **kw)
  File "<string>", line 4, in addAHSRemember
  File "/usr/lib/zope2.9/lib/python/OFS/ObjectManager.py", line 333, in
_setObject
    notify(ObjectAddedEvent(ob, self, id))
  File "/usr/lib/zope2.9/lib/python/zope/event/__init__.py", line 23, in
notify
    subscriber(event)
  File "/usr/lib/zope2.9/lib/python/zope/app/event/dispatching.py", line
66, in dispatch
    for ignored in subscribers(event, None):
  File "/usr/lib/zope2.9/lib/python/zope/component/__init__.py", line
181, in subscribers
    return sitemanager.subscribers(objects, interface)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Five/site/localsite.py",
line 136, in subscribers
    return self.adapters.subscribers(required, provided)
  File "/usr/lib/zope2.9/lib/python/zope/interface/adapter.py", line
481, in subscribers
    subscribers = [subscription(*objects)
  File "/usr/lib/zope2.9/lib/python/zope/app/event/objectevent.py", line
192, in objectEventNotify
    adapters = subscribers((event.object, event), None)
  File "/usr/lib/zope2.9/lib/python/zope/component/__init__.py", line
181, in subscribers
    return sitemanager.subscribers(objects, interface)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Five/site/localsite.py",
line 136, in subscribers
    return self.adapters.subscribers(required, provided)
  File "/usr/lib/zope2.9/lib/python/zope/interface/adapter.py", line
481, in subscribers
    subscribers = [subscription(*objects)
  File "/usr/lib/zope2.9/lib/python/OFS/subscribers.py", line 114, in
dispatchObjectMovedEvent
    callManageAfterAdd(ob, event.object, event.newParent)
  File "/usr/lib/zope2.9/lib/python/OFS/subscribers.py", line 137, in
callManageAfterAdd
    ob.manage_afterAdd(item, container)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/BaseContent.py", line 42, in manage_afterAdd
    CatalogMultiplex.manage_afterAdd(self, item, container)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFCore/CMFCatalogAware.py", line 202, in manage_afterAdd
    self.indexObject()
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/CatalogMultiplex.py", line 36, in indexObject
    c.catalog_object(self, url)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFPlone/CatalogTool.py",
line 357, in catalog_object
    update_metadata, pghandler=pghandler)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CacheSetup/patch.py",
line 87, in catalog_object
    return call(self, 'catalog_object', obj, uid, idxs, update_metadata)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CacheSetup/patch_utils.py", line 6, in call
    return getattr(self, PATTERN % __name__)(*args, **kw)
  File "/usr/lib/zope2.9/lib/python/Products/ZCatalog/ZCatalog.py", line
567, in catalog_object
    update_metadata=update_metadata)
  File "/usr/lib/zope2.9/lib/python/Products/ZCatalog/Catalog.py", line
339, in catalogObject
    index = self.updateMetadata(object, uid)
  File "/usr/lib/zope2.9/lib/python/Products/ZCatalog/Catalog.py", line
277, in updateMetadata
    newDataRecord = self.recordify(object)
  File "/usr/lib/zope2.9/lib/python/Products/ZCatalog/Catalog.py", line
416, in recordify
    attr=getattr(object, x, MV)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFPlone/CatalogTool.py",
line 100, in __getattr__
    return registry[name](obj, portal=self._portal, vars=vars, **kwargs)
  File
"/var/lib/zope2.9/instance/plone-site/Products/CMFPlone/CatalogTool.py",
line 196, in getObjSize
    size = obj.get_size()
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/BaseObject.py", line 584, in get_size
    size+=field.get_size(self)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/Field.py",
line 1311, in get_size
    return len(self.getBaseUnit(instance))
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/Field.py",
line 1305, in getBaseUnit
    return self.get(instance, raw=True)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/Field.py",
line 1278, in get
    value = self._wrapValue(instance, value)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/Field.py",
line 1033, in _wrapValue
    file=value, instance=instance)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/Field.py",
line 1168, in _make_file
    return self.content_class(id, file=file, instance=instance)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/BaseUnit.py",
line 34, in __init__
    self.update(file, instance, **kw)
  File
"/var/lib/zope2.9/instance/plone-site/Products/Archetypes/BaseUnit.py",
line 56, in update
    data, filename, mimetype = adapter(data, **kw)
  File
"/var/lib/zope2.9/instance/plone-site/Products/MimetypesRegistry/MimeTypesRegistry.py", line 370, in __call__
    mt = self.classify(data, mimetype=mimetype, filename=filename)
  File
"/var/lib/zope2.9/instance/plone-site/Products/MimetypesRegistry/MimeTypesRegistry.py", line 319, in classify
    if c.classify(data):
  File
"/var/lib/zope2.9/instance/plone-site/Products/MimetypesRegistry/mime_types/mtr_mimetypes.py", line 82, in classify
    m = re.search('^\s*<\\?xml.*\\?>', data)
  File "sre.py", line 134, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or buffer
2007-12-18 17:18:50 ERROR Zope.SiteErrorLog
http://localhost:8081/ahs/newspaper/createMember
Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Products.CMFFormController.FSControllerPythonScript, line 106,
in __call__
  Module Products.CMFFormController.ControllerBase, line 232, in getNext
   - __traceback_info__: ['id = createMember', 'status = success',
'button=None', 'errors={}', 'context=<AHSRemember at
ahsremember.2007-12-18.5276878797>', 'kwargs={}', 'next_action=None',
'']
  Module Products.CMFFormController.Actions.TraverseTo, line 38, in
__call__
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Products.CMFFormController.FSControllerPageTemplate, line 90,
in __call__
  Module Products.CMFFormController.BaseControllerPageTemplate, line 31,
in _call
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 195, in _exec
  Module Products.CacheSetup.patch_cmf, line 18, in FSPT_pt_render
  Module Products.CacheSetup.patch_utils, line 9, in call_pattern
  Module Products.CMFCore.FSPageTemplate, line 134, in pt_render
  Module Products.CacheSetup.patch_cmf, line 56, in PT_pt_render
  Module Products.CacheSetup.patch_utils, line 9, in call_pattern
  Module Products.PageTemplates.PageTemplate, line 104, in pt_render
   - <FSControllerPageTemplate at /ahs/newspaper/reg_form used
for /ahs/newspaper/portal_memberdata/portal_factory/AHSRemember/ahsremember.2007-12-18.5276878797>
  Module TAL.TALInterpreter, line 238, in __call__
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 749, in do_useMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 780, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 772, in do_defineSlot
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 728, in do_defineMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 455, in do_optTag_tal
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 455, in do_optTag_tal
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 691, in do_loop_tal
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 715, in do_condition
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 749, in do_useMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 457, in do_optTag_tal
  Module TAL.TALInterpreter, line 442, in do_optTag
  Module TAL.TALInterpreter, line 437, in no_tag
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 749, in do_useMacro
  Module TAL.TALInterpreter, line 281, in interpret
  Module TAL.TALInterpreter, line 507, in do_setLocal_tal
  Module Products.PageTemplates.TALES, line 221, in evaluate
   - URL: file:Archetypes/skins/archetypes/widgets/field.pt
   - Line 119, Column 6
   - Expression: <PythonExpr getMethod and getMethod()>
   - Names:
      {'container': <PloneSite at /ahs/newspaper>,
       'context': <AHSRemember
at /ahs/newspaper/portal_memberdata/portal_factory/AHSRemember/ahsremember.2007-12-18.5276878797>,
       'default': <Products.PageTemplates.TALES.Default instance at
0xa7146c0c>,
       'here': <AHSRemember
at /ahs/newspaper/portal_memberdata/portal_factory/AHSRemember/ahsremember.2007-12-18.5276878797>,
       'loop': <Products.PageTemplates.TALES.SafeMapping object at
0xc226f0c>,
       'modules':
<Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at
0xa70f20ac>,
       'nothing': None,
       'options': {'args': (),
                   'state':
<Products.CMFFormController.ControllerState.ControllerState object at
0xc226d4c>},
       'repeat': <Products.PageTemplates.TALES.SafeMapping object at
0xc226f0c>,
       'request': <HTTPRequest,
URL=http://localhost:8081/ahs/newspaper/createMember>,
       'root': <Application at >,
       'template': <FSControllerPageTemplate at /ahs/newspaper/reg_form
used
for /ahs/newspaper/portal_memberdata/portal_factory/AHSRemember/ahsremember.2007-12-18.5276878797>,
       'traverse_subpath': [],
       'user': <SpecialUser 'Anonymous User'>}
  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
   - __traceback_info__: getMethod and getMethod()
  Module Python expression "getMethod and getMethod()", line 1, in
<expression>
  Module Products.Archetypes.ClassGen, line 68, in generatedEditAccessor
  Module Products.Archetypes.Field, line 1256, in getRaw
  Module Products.Archetypes.Field, line 1278, in get
  Module Products.Archetypes.Field, line 1033, in _wrapValue
  Module Products.Archetypes.Field, line 1168, in _make_file
  Module Products.Archetypes.BaseUnit, line 34, in __init__
  Module Products.Archetypes.BaseUnit, line 56, in update
  Module Products.MimetypesRegistry.MimeTypesRegistry, line 370, in
__call__
  Module Products.MimetypesRegistry.MimeTypesRegistry, line 319, in
classify
  Module Products.MimetypesRegistry.mime_types.mtr_mimetypes, line 82,
in classify
  Module sre, line 134, in search
TypeError: expected string or buffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ahsremember.py
Type: text/x-python
Size: 3359 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20071218/a5e6b121/attachment.py>


More information about the Product-Developers mailing list