Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
583f197d
Commit
583f197d
authored
Jun 11, 2015
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_free_subscription_request: initial commit
parent
5ddd5fb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
24 deletions
+35
-24
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/Base_createFreeSubscriptionRequest.xml
..._free_subscription/Base_createFreeSubscriptionRequest.xml
+34
-24
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/Entity_createFreeSubscription.xml
.../erp5_free_subscription/Entity_createFreeSubscription.xml
+1
-0
No files found.
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/Base_createFreeSubscriptionRequest.xml
View file @
583f197d
...
...
@@ -51,38 +51,48 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != hmac:\n
from zExceptions import Unauthorized\n
raise Unauthorized\n
\n
event = portal.event_module[event_id]\n
\n
# First create a request\n
request = portal.free_subscription_request_module.newContent(\n
source=event.getSource(),\n
destination=event.getDestination(),\n
resource = event.getResource(),\n
free_subscription_request_type="unsubscription",\n
causality_value=event,\n
)\n
if subscription_type == "unsubscription":\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != hmac:\n
from zExceptions import Unauthorized\n
raise Unauthorized\n
\n
event = portal.event_module[event_id]\n
\n
# First create a request\n
request = portal.free_subscription_request_module.newContent(\n
source=event.getSource(),\n
destination=event.getDestination(),\n
resource = event.getResource(),\n
free_subscription_request_type="unsubscription",\n
causality_value=event,\n
)\n
\n
free_subscription_list = portal.portal_catalog(portal_type="Free Subscription",\n
default_resource_uid=event.getResourceUid(),\n
default_source_uid=event.getSourceUid(),\n
default_destination_uid=event.getDestinationUid())\n
\n
free_subscription_list = portal.portal_catalog(portal_type="Free Subscription",\n
default_resource_uid=event.getResourceUid(),\n
default_source_uid=event.getSourceUid(),\n
default_destination_uid=event.getDestinationUid())\n
if len(free_subscription_list) != 1:\n
raise ValueError("Impossible to find the free subscription (%d)" %\n
(len(free_subscription_list)))\n
free_subscription = free_subscription_list[0].getObject()\n
request.setFollowUpValue(free_subscription)\n
\n
if len(free_subscription_list) != 1:\n
raise ValueError("Impossible to find the free subscription (%d)" %\n
(len(free_subscription_list)))\n
free_subscription = free_subscription_list[0].getObject()\n
request.setFollowUpValue(free_subscription)\n
else:\n
request = portal.free_subscription_request_module.newContent(\n
source=source,\n
destination=destination,\n
resource=resource,\n
free_subscription_request_type="subscription",\n
causality=causality,\n
)\n
\n
request.submit()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
event_id, hmac
</string>
</value>
<value>
<string>
causality=None, resource=None, destination=None, source=None, event_id=None, hmac=None, subscription_type="unsubscription"
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/Entity_createFreeSubscription.xml
View file @
583f197d
...
...
@@ -57,6 +57,7 @@ free_subscription = context.getPortalObject().free_subscription_module.newConten
source=source,\n
resource=resource,\n
effective_date=start_date,\n
start_date=start_date,\n
title=title)\n
\n
free_subscription.validate()\n
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment