From: Marie R. <rob...@es...> - 2007-12-11 11:51:03
|
Oops I should have read to the bottom first....I *do* have a checkState script in my custom folder , thanks for the pointer Bastien! Marie Bastien Gauthier wrote: > As you can see here, something like "object/myCondition" or "python: object.myCondition()" should be right, please paste the full error traceback so we can see what is going wrong... > > Have a nice day, > > PS : take care that checkState can not exist as a script in your Plone. Check that no other checkState method or script is defined somewhere... > > BASTIEN Gauthier > Service Informatique - Administration Communale de Sambreville > 071/260.247 > http://www.sambreville.be > > > >> -----Message d'origine----- >> De : arc...@li... >> [mailto:arc...@li...] De la >> part de Marie ROBICHON >> Envoyé : mardi 11 décembre 2007 12:28 >> À : Luca >> Cc : arc...@li... >> Objet : Re: [Archetypes-users] condition on widget >> >> Hi Luca, >> >> thanks for the suggestion but I still get the same error - I >> need to pass 2 arguments, but I don't know what these are.... >> >> Marie >> >> Luca wrote: >> >>> try with >>> >>> object/checkState >>> >>> or >>> >>> python:object.checkState() >>> >>> On Dec 11, 2007 11:56 AM, Marie Robichon <rob...@es...> wrote: >>> >>> >>>> Hi, >>>> >>>> I have the following field: >>>> >>>> StringField('modified_element', >>>> index='FieldIndex:schema', >>>> vocabulary=['Date', >>>> 'Time', >>>> 'Location', >>>> 'Speaker'], >>>> widget = MultiSelectionWidget( >>>> description = 'If you have >>>> made significant modification(s) to this announcement since it was >>>> published, indicate them by checking the appropriate boxes.', >>>> description_msgid = >>>> help_modified_element', >>>> label = 'Significant >>>> modification(s) made to the following fields:', >>>> label_msgid = >>>> 'label_modified_element', >>>> condition="here/checkState", >>>> format='checkbox', >>>> i18n_domain = 'plone' >>>> )), >>>> >>>> I would like to display this widget only if my object is >>>> >> published. >> >>>> I have added the following method to my archetypes class: >>>> >>>> def checkState(self): >>>> """check review_state for the object""" >>>> portal_workflow = getToolByName(self, 'portal_workflow') >>>> review_state = portal_workflow.getInfoFor(self, >>>> >> 'review_state') >> >>>> if review_state =='published': >>>> return 1 >>>> else: >>>> return 0 >>>> >>>> which for already created objects renders the correct result when I >>>> add checkState to the url. >>>> >>>> However when I try to create a new object the >>>> condition="here/checkState" line raises this error >>>> TypeError: checkState() takes exactly 2 arguments (0 given) >>>> >>>> Could you please help me get the correct syntax in my method and/or >>>> in my field so that this error does not occur? >>>> >>>> Thanks in advance for your help. >>>> >>>> Marie >>>> >>>> >>>> >>>> >>>> >> --------------------------------------------------------------------- >> >>>> ---- >>>> SF.Net email is sponsored by: >>>> Check out the new SourceForge.net Marketplace. >>>> It's the best place to buy or sell services for just about anything >>>> Open Source. >>>> http://sourceforge.net/services/buy/index.php >>>> _______________________________________________ >>>> Archetypes-users mailing list >>>> Arc...@li... >>>> https://lists.sourceforge.net/lists/listinfo/archetypes-users >>>> >>>> >>>> >>> >>> >>> >> >> > > > > > |