Commit 941b16bb authored by Kevin Deldycke's avatar Kevin Deldycke

Return short or long title. If both are available, priority is given to one of...

Return short or long title. If both are available, priority is given to one of them via the 'priority' parameter (long title is chosen by default).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8586 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6755f1f6
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
This method return short or long title. If both are available, priority is given to one of\n
them via the \'priority\' parameter (long title is chosen by default).\n
\n
If both of them are empty, we return a generic string containing the id. The previous behaviour\n
can be de-activated via \'pure_id\' parameters.\n
\n
ERP5 Web rule:\n
Short title is diplayed in any navigation widget (breadrumb, navigation menu, section list, ...)\n
with a higher priority than long title, except in Site Map.\n
"""\n
\n
portal_type = context.getPortalType()\n
\n
property_list = [\'title\', \'short_title\', \'id\']\n
if priority == \'short_title\':\n
property_list = [\'short_title\', \'title\', \'id\']\n
\n
for property in property_list:\n
if hasattr(context, property):\n
value = getattr(context, property)\n
if value not in (None, \'\'):\n
if property == \'id\' and pure_id == False:\n
return "Untitled %s (id: %s)" % (context.getPortalType(), value)\n
return value\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>priority=\'long_title\', pure_id=False</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>priority</string>
<string>pure_id</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_type</string>
<string>property_list</string>
<string>_getiter_</string>
<string>property</string>
<string>hasattr</string>
<string>getattr</string>
<string>value</string>
<string>None</string>
<string>False</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<string>long_title</string>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Web_getVerboseTitle</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment