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
alecs_myu
erp5
Commits
fff656be
Commit
fff656be
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
c8f9394b
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 @
fff656be
...
@@ -51,38 +51,48 @@
...
@@ -51,38 +51,48 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string>
portal = context.getPortalObject()\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != hmac:\n
if subscription_type == "unsubscription":\n
from zExceptions import Unauthorized\n
if portal.Base_getHMACHexdigest(portal.Base_getEventHMACKey(), event_id) != hmac:\n
raise Unauthorized\n
from zExceptions import Unauthorized\n
\n
raise Unauthorized\n
event = portal.event_module[event_id]\n
\n
\n
event = portal.event_module[event_id]\n
# First create a request\n
\n
request = portal.free_subscription_request_module.newContent(\n
# First create a request\n
source=event.getSource(),\n
request = portal.free_subscription_request_module.newContent(\n
destination=event.getDestination(),\n
source=event.getSource(),\n
resource = event.getResource(),\n
destination=event.getDestination(),\n
free_subscription_request_type="unsubscription",\n
resource = event.getResource(),\n
causality_value=event,\n
free_subscription_request_type="unsubscription",\n
)\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
\n
free_subscription_list = portal.portal_catalog(portal_type="Free Subscription",\n
if len(free_subscription_list) != 1:\n
default_resource_uid=event.getResourceUid(),\n
raise ValueError("Impossible to find the free subscription (%d)" %\n
default_source_uid=event.getSourceUid(),\n
(len(free_subscription_list)))\n
default_destination_uid=event.getDestinationUid())\n
free_subscription = free_subscription_list[0].getObject()\n
request.setFollowUpValue(free_subscription)\n
\n
\n
if len(free_subscription_list) != 1:\n
else:\n
raise ValueError("Impossible to find the free subscription (%d)" %\n
request = portal.free_subscription_request_module.newContent(\n
(len(free_subscription_list)))\n
source=source,\n
free_subscription = free_subscription_list[0].getObject()\n
destination=destination,\n
request.setFollowUpValue(free_subscription)\n
resource=resource,\n
free_subscription_request_type="subscription",\n
causality=causality,\n
)\n
\n
\n
request.submit()\n
request.submit()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<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>
<item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<key>
<string>
_proxy_roles
</string>
</key>
...
...
bt5/erp5_free_subscription/SkinTemplateItem/portal_skins/erp5_free_subscription/Entity_createFreeSubscription.xml
View file @
fff656be
...
@@ -57,6 +57,7 @@ free_subscription = context.getPortalObject().free_subscription_module.newConten
...
@@ -57,6 +57,7 @@ free_subscription = context.getPortalObject().free_subscription_module.newConten
source=source,\n
source=source,\n
resource=resource,\n
resource=resource,\n
effective_date=start_date,\n
effective_date=start_date,\n
start_date=start_date,\n
title=title)\n
title=title)\n
\n
\n
free_subscription.validate()\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