Commit 75688d10 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_officejs_support_request_ui: do small speed improvement

on getting project list in the support request fast input dialog
parent 114c40af
......@@ -145,7 +145,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:[(o.getTitle(), o.getId()) for o in context.getPortalObject().portal_catalog(portal_type="Project", validation_state="validated")]</string> </value>
<value> <string>python:[(o.getProperty("title"), o.getProperty("id")) for o in context.getPortalObject().portal_catalog(portal_type="Project", validation_state="validated", select_list=("id", "title"))]</string> </value>
</item>
</dictionary>
</pickle>
......
  • @tc : why using (o.getProperty("title"), o.getProperty("id")) instead of (o.title, o.id). I think that accessing the property directly instead of using a getter introduces less overhead and makes things easier to read.

  • Using (o.title, o.id) should be better in some cases. I am using getProperty to be more explicit on the fallback to object property if not given by select_list.

    E.g. o.validation_state raises if not given by select_list, this acts differently than using getProperty("validation_state").

    However, there's a magic for o.title and o.id that get the object property even if not given by select_list. So it acts exactly like getProperty("title").

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