|
|
|
|
|
|
Login
|
erp5.org has permanently moved to wiki.erp5.org ! Current status of ERP5 community websites:
Note: if you created content in this ancient portal, please migrate it to the wiki. The old website will stay online as long as all contents are not mograted to the wiki.
Programming Tips
Always use accessors to access / set object propertiesObject attributes should always be modified through a method call. Modifying an object attribute by accessing an attribute is considered as a programming error. Do not use invokeFactory: use newContentIf you use invokeFactory, you will not be able to manage permissions. invoikeFactory requires AddPortalContent. Use constructContent instead:
context.portal_types.constructContent(type_name=string.join(doAction[1:],' '),
container=context,
id=str(context.generateNewId()),
RESPONSE=request.RESPONSE)
Never associate a module to a workflowModules (which use the class Folder) should not be associate to a workflow. Otherwise, they will likely be unaccessible by users because of permissions settings in the workflow. To manage security of a module, use the ZMI. Category accesors and propertiesERP5 automatically generates Category Getters (eg. for a category called destination a method named getDestinationTitle). However, it does not generate a setter (eg. setDestinationTitle). This may lead to unpredictable errors. Currently, if in a form, a property related to a category can be edited (eg. with a RelationStringField), the _edit function of Base will receive a property value as input (eg. destination_title) which corresponds to nothing defined in a PropertySheet. It will likely store it as a python object attribute, after trying to call an acquire getter method. This is very dangerous. Therefore, here is the rule
Rationale:
Naming Workflow VariablesRule: use different id for catalogue variables which may be used by 2 non exclusive worklows Rule: use the same id for variables which have the same meaning and are used by exclusive workflows Rule: use the same id for variables which have the same meaning and are not catalogued Briefly: only use different id for catalogued worklows variables which belong to non mutually exclusive workflows. Example: state variable. |
|
|