Commit 4426961a authored by Nicolas Delaby's avatar Nicolas Delaby

Avoid unnecessary Acquisitions lookup

remove empty values in edit_kw

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43725 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e98776c4
No related merge requests found
......@@ -52,20 +52,18 @@
<key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n
from AccessControl import getSecurityManager\n
portal = context.getPortalObject()\n
\n
# Search current user ID\n
user_id = getSecurityManager().getUser().getId()\n
source = None\n
person_subordination = None\n
for person in context.portal_catalog(reference=user_id, portal_type=\'Person\'):\n
for person in portal.portal_catalog(reference=user_id, portal_type=\'Person\'):\n
source = person.getRelativeUrl()\n
person_subordination = person.getSubordination()\n
break\n
\n
follow_up_url = None\n
start_date = DateTime()\n
stop_date = None\n
causality = None\n
destination = context.getRelativeUrl()\n
\n
if direction == \'out\':\n
......@@ -85,7 +83,7 @@ elif direction == \'in\':\n
destination_url = source\n
destination_section_url = person_subordination\n
else:\n
raise KeyError, \'Direction Specified not handling: %s\' % direction\n
raise NotImplementedError, \'The specified direction is not handled: %r\' % (direction,)\n
\n
event_kw = {}\n
event_kw[\'portal_type\'] = portal_type\n
......@@ -95,16 +93,13 @@ event_kw[\'source\'] = source_url\n
event_kw[\'source_section\'] = source_section_url\n
event_kw[\'destination\'] = destination_url\n
event_kw[\'destination_section\'] = destination_section_url\n
event_kw[\'follow_up\'] = follow_up_url\n
event_kw[\'start_date\'] = start_date\n
event_kw[\'stop_date\'] = stop_date\n
event_kw[\'causality\'] = causality\n
\n
# Create event\n
module = context.getDefaultModule(portal_type=portal_type)\n
module = portal.getDefaultModule(portal_type=portal_type)\n
event = module.newContent(**event_kw)\n
\n
message = context.Base_translateString(\'New event created.\')\n
message = portal.Base_translateString(\'New event created.\')\n
\n
event.Base_redirect(keep_items={\'portal_status_message\': message})\n
</string> </value>
......
522
\ No newline at end of file
523
\ No newline at end of file
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