Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 328, in _exec
  Module None, line 49, in testcreateArbo
   - <CustomizedPythonScript at /liris/SITE/essai/testcreateArbo>
   - Line 49
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 328, in _exec
  Module None, line 26, in createImportedEvtForHelp
   - <CustomizedPythonScript at /liris/SITE/essai/createImportedEvtForHelp>
   - Line 26
  Module Products.ATContentTypes.lib.constraintypes, line 281, in
invokeFactory
  Module Products.CMFCore.PortalFolder, line 315, in invokeFactory
  Module Products.CMFCore.TypesTool, line 716, in constructContent
  Module Products.CMFCore.TypesTool, line 276, in constructInstance
  Module Products.CMFCore.TypesTool, line 450, in _constructInstance
  Module Products.ATContentTypes.content.event, line 10, in addATEvent
  Module Products.ATContentTypes.content.base, line 136, in
initializeArchetype
  Module Products.ATContentTypes.content.base, line 177, in edit
TypeError: cmf_edit() got an unexpected keyword argument 'modification_date'

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

createImportedEvtForHelp.py

parameters : elt=None, folder=None
  elt : dictionnary of event data to be imported
  folder : destination folder


if elt is None or folder is None:
    return "elt (%s) or folder (%s) is none\n" % (elt, folder)

portal = context.portal_url.getPortalObject()

cEvt = None

cEvt = folder.invokeFactory('Event',
                            id = elt["metadata"]["getId"],
                            title =
elt["metadata"]["Title"].decode("latin1").encode("utf-8"),
                            location =
elt["location"].decode("latin1").encode("utf-8"),
                            start_date = elt["start"],
                            end_date = elt["end"],

modification_date=elt["metadata"]["ModificationDate"],
                            contact_name =
elt["contact_name"].decode("latin1").encode("utf-8"),
                            contact_email =
elt["contact_email"].decode("latin1").encode("utf-8"),
                            event_url = elt["event_url"]
                            )

if cEvt is not None:
    ...

--------------------
Example of the elt dictionnary content


{'contact_email': '[email protected]',
 'contact_name': '',
 'contact_phone': '',
 'description': "S\xe9minaire de ...",
 'effective_date': '',
 'end': '2004-10-20 15:00:00',
 'event_url': 'http://aaaa/bbb/',
 'expiration_date': '',
 'id': 'Event.2004-09-14.3148',
 'location': 'Salle de r\xe9union, xxx',
 'metadata': {'CreationDate': '2004-09-14 11:31:48',
              'Creator': 'nameofc',
              'Date': '2004-10-12 10:03:28',
              'Description': "S\xe9minaire de ...",
              'EffectiveDate': '',
              'ModificationDate': '2004-10-12 10:03:28',
              'Subject': ('S\xe9minaire',),
              'Title': "S\xe9minaires de ...",
              'Type': 'Event',
              'created': '2004-09-14 11:31:48',
              'effective': '0999-12-31',
              'end': '2004-10-20 15:00:00',
              'expires': '9998-12-31',
              'getIcon': 'event_icon.gif',
              'getId': 'Event.2004-09-14.3148',
              'meta_type': 'CMF Event',
              'modified': '2004-10-12 10:03:28',
              'portal_type': 'Event',
              'review_state': 'published',
              'start': '2004-10-20 13:30:00'},
 'objpath': ('',
             'labo',
             'prod',
             'Members',
             'nameofc',
             'Event.2004-09-14.3148'),
 'start': '2004-10-20 13:30:00',
 'subject': ('S\xe9minaire',),
 'title': "S\xe9minaires de ..."}

2009/7/11 Andreas Jung <[email protected]>

> On 10.07.09 19:15, Françoise CONIL wrote:
> > invokeFactory() does not allow all metadata parameters, for instance,
> > here are two errors I got when "importing" Events  :
> >    cmf_edit() got an unexpected keyword argument 'modification_date'
> >    cmf_edit() got an unexpected keyword argument 'subject'
>
> Provide code and full traceback - until then I have strong doubts about
> you are saying.
>
> -aj
>
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to