Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Lu Xu
slapos.core
Commits
ec5475e3
Commit
ec5475e3
authored
Feb 21, 2017
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_trial: Use Configuration script to load the Free Trial Options.
parent
246d37c8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
21 deletions
+74
-21
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/TrialRequest_getTrialConfiguration.py
..._skins/slapos_trial/TrialRequest_getTrialConfiguration.py
+1
-0
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/TrialRequest_getTrialConfiguration.xml
...skins/slapos_trial/TrialRequest_getTrialConfiguration.xml
+62
-0
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/TrialRequest_processRequest.py
.../portal_skins/slapos_trial/TrialRequest_processRequest.py
+3
-4
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/WebSite_requestFreeTrialProxy.py
...ortal_skins/slapos_trial/WebSite_requestFreeTrialProxy.py
+8
-17
No files found.
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/TrialRequest_getTrialConfiguration.py
0 → 100644
View file @
ec5475e3
raise
ValueError
(
"Free Trial is disabled!"
)
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/TrialRequest_getTrialConfiguration.xml
0 → 100644
View file @
ec5475e3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</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>
_params
</string>
</key>
<value>
<string>
software_release
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
TrialRequest_getTrialConfiguration
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/TrialRequest_processRequest.py
View file @
ec5475e3
...
...
@@ -7,22 +7,21 @@ if person is None:
return
if
context
.
getSpecialise
()
is
not
None
:
return
return
if
context
.
getValidationState
()
==
"validated"
:
return
state
=
"started"
shared
=
False
request_kw
=
{}
request_kw
.
update
(
software_release
=
context
.
getUrlString
(),
software_title
=
context
.
getTitle
()
+
" %s"
%
str
(
context
.
getUid
()),
software_type
=
"RootSoftwareInstance"
,
software_type
=
context
.
getSourceReference
()
,
instance_xml
=
context
.
getTextContent
(),
sla_xml
=
""
,
shared
=
shared
,
shared
=
context
.
getRootSlave
()
,
state
=
state
,
)
...
...
master/bt5/slapos_trial_request/SkinTemplateItem/portal_skins/slapos_trial/WebSite_requestFreeTrialProxy.py
View file @
ec5475e3
...
...
@@ -7,20 +7,10 @@ if REQUEST is not None:
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
##### Starting Hardcoded Information ######
instance_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
</instance>
"""
software_type
=
"RootSoftwareInstance"
#url = 'http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/request.product:/software/cdn-me/software.cfg'
url
=
"https://lab.node.vifib.com/nexedi/slapos/raw/1.0.21/software/cdn-me/software.cfg"
shared
=
True
trial_configuration
=
context
.
TrialRequest_getTrialConfiguration
(
software_release
)
######
software_title
=
"'CDN ME free trial' for '%s'"
%
(
email
)
software_title
=
trial_configuration
[
"base_software_title"
]
%
(
email
)
trial_request
=
portal
.
portal_catalog
.
getResultValue
(
...
...
@@ -39,19 +29,20 @@ trial_request_list = portal.portal_catalog(
limit
=
31
)
if
len
(
trial_request_list
)
>=
3
0
:
if
len
(
trial_request_list
)
>=
1
0
:
return
context
.
Base_redirect
(
"slapos-Free.Trial.ExceedLimit.Message"
)
now
=
DateTime
()
trial
=
context
.
trial_request_module
.
newContent
(
source_reference
=
"RootSoftwareInstance"
,
source_reference
=
trial_configuration
[
"software_type"
]
,
title
=
software_title
,
url_string
=
url
,
text_content
=
instance_xml
,
url_string
=
trial_configuration
[
"url"
]
,
text_content
=
trial_configuration
[
"instance_xml"
]
,
start_date
=
now
,
stop_date
=
now
+
21
stop_date
=
now
+
30
,
root_slave
=
trial_configuration
[
"shared"
]
)
trial
.
setDefaultEmailText
(
email
)
...
...
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