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
Labels
Merge Requests
139
Merge Requests
139
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
70d38eee
Commit
70d38eee
authored
Dec 16, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal/web_renderjs_ui/officejs] Fix python coding style
parent
f3c57d2d
Pipeline
#7136
failed with stage
in 0 seconds
Changes
32
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
135 additions
and
158 deletions
+135
-158
bt5/erp5_hal_json_style/ExtensionTemplateItem/portal_components/extension.erp5.HalStyle.py
...TemplateItem/portal_components/extension.erp5.HalStyle.py
+1
-2
bt5/erp5_hal_json_style/ExtensionTemplateItem/portal_components/extension.erp5.HalStyle.xml
...emplateItem/portal_components/extension.erp5.HalStyle.xml
+21
-20
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+2
-7
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_edit.py
...emplateItem/portal_skins/erp5_hal_json_style/Base_edit.py
+4
-6
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
...ateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
+3
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
...teItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
+1
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+12
-19
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
...portal_skins/erp5_hal_json_style/Workflow_statusModify.py
+1
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+13
-13
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalRestrictedJsonStyle.py
...portal_components/test.erp5.testHalRestrictedJsonStyle.py
+4
-4
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalRestrictedJsonStyle.xml
...ortal_components/test.erp5.testHalRestrictedJsonStyle.xml
+20
-16
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/Form_getFieldsRawProperties.py
...skins/erp5_officejs_common/Form_getFieldsRawProperties.py
+1
-1
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
...aticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
+4
-4
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_web_officejs_ui/Base_createAppConfigurationManifest.py
...p5_web_officejs_ui/Base_createAppConfigurationManifest.py
+1
-2
bt5/erp5_officejs/TestTemplateItem/portal_components/test.erp5.testErp5Officejs.py
...plateItem/portal_components/test.erp5.testErp5Officejs.py
+0
-1
bt5/erp5_officejs/TestTemplateItem/portal_components/test.erp5.testErp5Officejs.xml
...lateItem/portal_components/test.erp5.testErp5Officejs.xml
+20
-16
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_getRelatedWebSite.py
...ficejs_appstore_base/SoftwareProduct_getRelatedWebSite.py
+0
-2
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_init.py
...skins/erp5_officejs_appstore_base/SoftwareProduct_init.py
+0
-1
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_updateApplication.py
...ficejs_appstore_base/SoftwareProduct_updateApplication.py
+2
-2
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_selectVersion.py
...ficejs_appstore_base/SoftwarePublication_selectVersion.py
+0
-3
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_submitSoftwarePublication.py
...ore_base/SoftwarePublication_submitSoftwarePublication.py
+2
-2
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareRelease_publishRelatedWebDocument.py
...ppstore_base/SoftwareRelease_publishRelatedWebDocument.py
+0
-1
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/WebManifest_createCloneFile.py
...rp5_officejs_appstore_base/WebManifest_createCloneFile.py
+0
-2
bt5/erp5_officejs_appstore_base/WorkflowTemplateItem/portal_workflow/officejs_software_publication_workflow/scripts/checkConsistency.py
...software_publication_workflow/scripts/checkConsistency.py
+2
-2
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/PostModule_createHTMLPostForSupportRequest.py
...ort_request/PostModule_createHTMLPostForSupportRequest.py
+0
-1
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequestModule_generateRSSLinkAsJson.py
...ort_request/SupportRequestModule_generateRSSLinkAsJson.py
+0
-1
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/Base_createTranslateData.py
...ortal_skins/erp5_web_renderjs/Base_createTranslateData.py
+0
-5
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/Base_getListFileFromAppcache.py
...l_skins/erp5_web_renderjs/Base_getListFileFromAppcache.py
+15
-16
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/File_viewAsWeb.py
...eItem/portal_skins/erp5_web_renderjs_ui/File_viewAsWeb.py
+4
-4
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.py
...5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.py
+1
-1
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSite_logout.py
...eItem/portal_skins/erp5_web_renderjs_ui/WebSite_logout.py
+0
-1
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/ERP5Site_createPersonToAskAccountRecover.py
...derjs_ui_test/ERP5Site_createPersonToAskAccountRecover.py
+1
-1
No files found.
bt5/erp5_hal_json_style/ExtensionTemplateItem/portal_components/extension.erp5.HalStyle.py
View file @
70d38eee
...
...
@@ -2,7 +2,6 @@ from Acquisition import aq_self, aq_base, aq_inner
from
Products.ERP5Type.Utils
import
UpperCase
from
ZODB.POSException
import
ConflictError
from
AccessControl
import
Unauthorized
from
Products.ZSQLCatalog.zsqlbrain
import
ZSQLBrain
def
Base_aqSelf
(
self
):
...
...
@@ -68,7 +67,7 @@ def Listbox_getBrainValue(self, brain, obj, select, can_check_local_property, ed
default_field_value
=
default_field_value
()
except
(
ConflictError
,
RuntimeError
):
raise
except
:
except
Exception
:
default_field_value
=
None
# Listbox.py forces result to be an empty string
...
...
bt5/erp5_hal_json_style/ExtensionTemplateItem/portal_components/extension.erp5.HalStyle.xml
View file @
70d38eee
...
...
@@ -45,10 +45,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 71, 4: No exception type(s) specified (bare-except)
</string>
<string>
W: 5, 0: Unused ZSQLBrain imported from Products.ZSQLCatalog.zsqlbrain (unused-import)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -103,11 +100,13 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
...
...
@@ -120,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
70d38eee
...
...
@@ -12,13 +12,10 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
extra_param_json - JSON serialized extra parameters for the dialog script
"""
from
Products.ERP5Type.Log
import
log
,
DEBUG
,
INFO
,
WARNING
,
ERROR
from
Products.Formulator.Errors
import
FormValidationError
,
ValidationError
from
ZTUtils
import
make_query
from
Products.ERP5Type.Log
import
log
,
WARNING
from
Products.Formulator.Errors
import
FormValidationError
import
json
DOCUMENT_COUNT_LIMIT
=
50
# http://stackoverflow.com/a/13105359
def
byteify
(
value
):
if
isinstance
(
value
,
dict
):
...
...
@@ -53,7 +50,6 @@ else:
# request.form holds POST data thus containing 'field_' + field.id items
# such as 'field_your_some_field'
request_form
=
request
.
form
error_message
=
''
translate
=
context
.
Base_translateString
portal
=
context
.
getPortalObject
()
...
...
@@ -161,7 +157,6 @@ except FormValidationError as validation_errors:
MARKER
=
[]
# A recognisable default value. Use with 'is', not '=='.
listbox_id_list
=
[]
# There should not be more than one listbox - but this give us a way to check.
file_id_list
=
[]
# For uploaded files.
for
field
in
form
.
get_fields
():
field_id
=
field
.
id
field_value
=
request
.
get
(
field_id
,
MARKER
)
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_edit.py
View file @
70d38eee
...
...
@@ -141,10 +141,10 @@ def editMatrixBox(matrixbox_field, matrixbox):
columns
=
matrixbox_field
.
get_value
(
'columns'
)
tabs
=
matrixbox_field
.
get_value
(
'tabs'
)
column_ids
=
map
(
lambda
x
:
x
[
0
],
columns
)
line_ids
=
map
(
lambda
x
:
x
[
0
],
lines
)
tab_ids
=
map
(
lambda
x
:
x
[
0
],
tabs
)
extra_dimension_category_list_list
=
[[
category
for
category
,
label
in
dimension_list
]
for
dimension_list
in
extra_dimension_list_list
]
column_ids
=
[
x
[
0
]
for
x
in
columns
]
line_ids
=
[
x
[
0
]
for
x
in
lines
]
tab_ids
=
[
x
[
0
]
for
x
in
tabs
]
extra_dimension_category_list_list
=
[[
category
for
category
,
_
in
dimension_list
]
for
dimension_list
in
extra_dimension_list_list
]
# There are 3 cases
# Case 1: we do 1 dimensional matrix
...
...
@@ -247,8 +247,6 @@ spp = context.getPhysicalPath()
spp
=
list
(
spp
)
s_url
=
request
[
"SERVER_URL"
]
spp
.
insert
(
0
,
s_url
)
#calculate direct the url instead of using absolute_url
new_url
=
'/'
.
join
(
spp
)
# for web mode, we should use 'view' instead of passed form_id
# after 'Save & View'.
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.py
View file @
70d38eee
...
...
@@ -7,6 +7,9 @@ from zExceptions import Redirect
from
ZTUtils
import
make_query
import
json
if
keep_items
is
None
:
keep_items
=
{}
request_form
=
context
.
REQUEST
.
form
previous_form_id
=
request_form
.
get
(
'form_id'
,
''
)
request_form
.
update
(
kw
)
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_redirect.xml
View file @
70d38eee
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id=\'view\', keep_items=
{}
, abort_transaction=False, **kw
</string>
</value>
<value>
<string>
form_id=\'view\', keep_items=
None
, abort_transaction=False, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
70d38eee
...
...
@@ -54,17 +54,18 @@ from DateTime import DateTime
from
ZODB.POSException
import
ConflictError
import
datetime
import
time
from
email.
U
tils
import
formatdate
from
email.
u
tils
import
formatdate
import
re
from
zExceptions
import
Unauthorized
from
Products.ERP5Type.Log
import
log
,
DEBUG
,
INFO
,
WARNING
,
ERROR
from
Products.ERP5Type.Log
import
log
,
WARNING
,
ERROR
from
Products.ERP5Type.Message
import
Message
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
ComplexQuery
from
collections
import
OrderedDict
from
Products.ERP5Form.Selection
import
Selection
from
Products.PythonScripts.standard
import
Object
MARKER
=
Object
()
MARKER
=
[]
COUNT_LIMIT
=
1000
if
REQUEST
is
None
:
...
...
@@ -77,12 +78,6 @@ if response is None:
response
=
REQUEST
.
RESPONSE
def
isFieldType
(
field
,
type_name
):
if
field
.
meta_type
==
'ProxyField'
:
field
=
field
.
getRecursiveTemplateField
()
return
field
.
meta_type
==
type_name
def
toBasicTypes
(
obj
):
"""Ensure that obj contains only basic types."""
if
obj
is
None
:
...
...
@@ -97,7 +92,7 @@ def toBasicTypes(obj):
return
obj
.
translate
()
try
:
return
{
toBasicTypes
(
key
):
toBasicTypes
(
obj
[
key
])
for
key
in
obj
}
except
:
except
Exception
:
log
(
'Cannot convert {!s} to basic types {!s}'
.
format
(
type
(
obj
),
obj
),
level
=
100
)
return
obj
...
...
@@ -246,7 +241,7 @@ def selectKwargsForCallable(func, initial_kwargs, kwargs_dict):
if
script_params
is
not
None
:
# In case the func is actualy Script (Python) or ERP5 Python Script
func_param_list
=
[
tuple
(
map
(
lambda
x
:
x
.
strip
(),
func_param
.
split
(
'='
))
)
func_param_list
=
[
tuple
(
[
x
.
strip
()
for
x
in
func_param
.
split
(
'='
)]
)
for
func_param
in
script_params
.
split
(
","
)
if
func_param
.
strip
()]
elif
hasattr
(
func
,
"func_args"
):
...
...
@@ -414,7 +409,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
# this listbox expects field_id to point to the "parent" relation field
# thus setting the field_id is optional and controlled by `request_field` argument
if
request_field
:
previous_request_field
=
REQUEST
.
other
.
pop
(
'field_id'
,
None
)
#
previous_request_field = REQUEST.other.pop('field_id', None)
REQUEST
.
other
[
'field_id'
]
=
field
.
id
if
meta_type
is
None
:
...
...
@@ -940,7 +935,6 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
proxy_form_id_list
=
[(
'Base_viewRelatedObjectListBase/listbox'
,
'default'
)]
# Create the possible choices
root_url
=
site_root
.
absolute_url
()
renderHiddenField
(
response_dict
,
"proxy_form_id_list"
,
''
)
response_dict
[
"proxy_form_id_list"
].
update
({
"items"
:
[(
Base_translateString
(
y
),
url_template_dict
[
'traverse_generator_action'
]
%
{
...
...
@@ -1403,7 +1397,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
'href'
:
'%s'
%
view_action
[
'url'
],
'name'
:
view_action
[
'id'
],
'icon'
:
view_action
[
'icon'
],
'title'
:
Base_translateString
(
view_action
[
'title'
])
'title'
:
Base_translateString
(
view_action
[
'title'
])
,
})
global_action_type
=
(
"view"
,
"workflow"
,
"object_new_content_action"
,
...
...
@@ -1549,7 +1543,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
}
elif
relative_url
==
'portal_preferences'
:
preference_tool
=
portal
.
portal_preferences
preference
=
traversed_document
.
getActiveUserPreference
()
if
preference
:
result_dict
[
'_links'
][
'active_preference'
]
=
{
...
...
@@ -1998,7 +1991,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
selection
=
catalog_kw
[
'selection'
],
selection_name
=
catalog_kw
[
'selection_name'
],
column_id
=
select
)
except
AttributeError
as
e
:
except
AttributeError
:
# In case the URL method is invalid or empty, we expect to have no link
# for the column to maintain compatibility with old UI, hence we create
# an empty url_parameter_dict for these cases.
...
...
@@ -2019,7 +2012,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
)
except
(
ConflictError
,
RuntimeError
):
raise
except
:
except
Exception
:
log
(
'could not evaluate the url method getListItemUrlDict with %r'
%
brain
,
level
=
800
)
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
View file @
70d38eee
...
...
@@ -2,7 +2,7 @@ from Products.CMFCore.WorkflowCore import WorkflowException
from
Products.Formulator.Errors
import
FormValidationError
from
Products.DCWorkflow.DCWorkflow
import
ValidationFailed
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Log
import
log
,
WARNING
from
Products.ERP5Type.Log
import
WARNING
portal
=
context
.
getPortalObject
()
request
=
REQUEST
or
context
.
REQUEST
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
70d38eee
...
...
@@ -2151,7 +2151,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
# Create the listbox selection
fake_request
=
do_fake_request
(
"GET"
)
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"search"
,
local_roles
=
[
"Manager"
],
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalRestrictedJsonStyle.py
View file @
70d38eee
...
...
@@ -10,7 +10,7 @@ class TestHalRestricted(ERP5HALJSONStyleSkinsMixin):
def
test_mode_root
(
self
):
fake_request
=
do_fake_request
(
"GET"
)
self
.
logout
()
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
)
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
status
,
401
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
getHeader
(
'WWW-Authenticate'
),
'X-Delegate uri="%s/connection/login_form{?came_from}"'
%
self
.
portal
.
web_site_module
.
hateoas
.
absolute_url
()
...
...
@@ -25,7 +25,7 @@ class TestHalRestricted(ERP5HALJSONStyleSkinsMixin):
document_relative_url
=
self
.
_makeDocument
().
getRelativeUrl
()
fake_request
=
do_fake_request
(
"GET"
)
self
.
logout
()
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"traverse"
,
relative_url
=
document_relative_url
)
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"traverse"
,
relative_url
=
document_relative_url
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
status
,
401
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
getHeader
(
'WWW-Authenticate'
),
'X-Delegate uri="%s/connection/login_form{?came_from}"'
%
self
.
portal
.
web_site_module
.
hateoas
.
absolute_url
()
...
...
@@ -39,7 +39,7 @@ class TestHalRestricted(ERP5HALJSONStyleSkinsMixin):
def
test_mode_search
(
self
):
fake_request
=
do_fake_request
(
"GET"
)
self
.
logout
()
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"search"
)
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"search"
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
status
,
401
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
getHeader
(
'WWW-Authenticate'
),
'X-Delegate uri="%s/connection/login_form{?came_from}"'
%
self
.
portal
.
web_site_module
.
hateoas
.
absolute_url
()
...
...
@@ -53,7 +53,7 @@ class TestHalRestricted(ERP5HALJSONStyleSkinsMixin):
def
test_mode_worklist
(
self
):
fake_request
=
do_fake_request
(
"GET"
)
self
.
logout
()
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"worklist"
)
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"worklist"
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
status
,
401
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
getHeader
(
'WWW-Authenticate'
),
'X-Delegate uri="%s/connection/login_form{?came_from}"'
%
self
.
portal
.
web_site_module
.
hateoas
.
absolute_url
()
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalRestrictedJsonStyle.xml
View file @
70d38eee
...
...
@@ -100,11 +100,13 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
...
...
@@ -117,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/Form_getFieldsRawProperties.py
View file @
70d38eee
...
...
@@ -23,7 +23,7 @@ def getFieldRawProperties(field, meta_type=None, key=None, key_prefix=None):
gadget_field_patch
=
False
for
key
in
field
.
values
.
keys
():
# sometimes, field.values returns a key as string and also as a tuple
if
type
(
key
)
is
str
:
if
isinstance
(
key
,
str
)
:
result
[
"values"
][
key
]
=
field
.
values
[
key
]
if
key
==
"columns"
:
form_list_patch
=
True
...
...
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
View file @
70d38eee
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_web_officejs_ui/Base_createAppConfigurationManifest.py
View file @
70d38eee
import
re
import
json
import
base64
from
datetime
import
datetime
...
...
@@ -65,7 +64,7 @@ try:
app_action_string
=
app_action_string
.
replace
(
'('
,
'['
).
replace
(
')'
,
']'
).
replace
(
',]'
,
']'
).
replace
(
"'"
,
'"'
)
app_action_raw_list
=
json
.
loads
(
app_action_string
)
for
app_action
in
app_action_raw_list
:
pair
=
app_action
.
split
(
" | "
)
;
pair
=
app_action
.
split
(
" | "
)
if
len
(
pair
)
!=
2
:
raise
SyntaxError
(
"Syntax error in app_action router setting"
)
app_action_list
.
append
(
pair
)
...
...
bt5/erp5_officejs/TestTemplateItem/portal_components/test.erp5.testErp5Officejs.py
View file @
70d38eee
# Copyright (c) 2002-2017 Nexedi SA and Contributors. All Rights Reserved.
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
base64
import
b64decode
...
...
bt5/erp5_officejs/TestTemplateItem/portal_components/test.erp5.testErp5Officejs.xml
View file @
70d38eee
...
...
@@ -100,11 +100,13 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
...
...
@@ -117,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_getRelatedWebSite.py
View file @
70d38eee
return
context
.
getFollowUpValue
(
portal_type
=
"Web Section"
)
raise
ValueError
(
"Unimplemented"
)
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_init.py
View file @
70d38eee
# Define Reference from ID provided by portal_ids
portal
=
context
.
getPortalObject
()
type_definition
=
context
.
getTypeInfo
()
# XXX Hardcoded
short_portal_type
=
"OSP"
...
...
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareProduct_updateApplication.py
View file @
70d38eee
...
...
@@ -38,7 +38,7 @@ software_release = portal.software_release_module.newContent(
)
# Create Software Publication Line
software_publication
_line
=
software_publication
.
newContent
(
software_publication
.
newContent
(
portal_type
=
"Software Publication Line"
,
title
=
software_publication
.
getTitle
()
+
" Publication"
,
aggregate_list
=
[
software_release
.
getRelativeUrl
(),
software_product
.
getSaleSupplyLineAggregate
()],
...
...
@@ -46,7 +46,7 @@ software_publication_line = software_publication.newContent(
activate_kw
=
{
"tag"
:
tag
}
)
zip_file
=
software_publication
.
Base_contribute
(
software_publication
.
Base_contribute
(
file
=
file
,
attach_document_to_context
=
True
,
portal_type
=
"File"
,
...
...
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_selectVersion.py
View file @
70d38eee
REQUEST
=
context
.
REQUEST
RESPONSE
=
REQUEST
.
RESPONSE
software_release
=
context
.
SoftwarePublication_getRelatedSoftwareRelease
()
software_release
.
SoftwareRelease_publishRelatedWebDocument
()
message
=
context
.
getTitle
()
+
" Published"
...
...
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwarePublication_submitSoftwarePublication.py
View file @
70d38eee
...
...
@@ -54,8 +54,8 @@ if base:
base
+=
"/"
base_length
=
len
(
base
)
def
extractWebManifest
(
file
):
html
=
context
.
Base_parseHtml
(
file
)
def
extractWebManifest
(
html_
file
):
html
=
context
.
Base_parseHtml
(
html_
file
)
for
tag
in
html
:
if
tag
[
0
]
==
'starttag'
and
tag
[
1
]
==
'link'
and
(
'rel'
,
'manifest'
)
in
tag
[
2
]:
for
attribute
in
tag
[
2
]:
...
...
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/SoftwareRelease_publishRelatedWebDocument.py
View file @
70d38eee
portal
=
context
.
getPortalObject
()
software_release
=
context
software_product
=
context
.
getFollowUpValue
(
portal_type
=
"Software Product"
)
...
...
bt5/erp5_officejs_appstore_base/SkinTemplateItem/portal_skins/erp5_officejs_appstore_base/WebManifest_createCloneFile.py
View file @
70d38eee
from
random
import
randint
portal
=
context
.
getPortalObject
()
# Get Software Product Object
...
...
bt5/erp5_officejs_appstore_base/WorkflowTemplateItem/portal_workflow/officejs_software_publication_workflow/scripts/checkConsistency.py
View file @
70d38eee
obj
ect
=
state_change
[
'object'
]
obj
ect
.
Base_checkConsistency
()
obj
=
state_change
[
'object'
]
obj
.
Base_checkConsistency
()
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/PostModule_createHTMLPostForSupportRequest.py
View file @
70d38eee
from
Products.ERP5Type.Message
import
translateString
portal
=
context
.
getPortalObject
()
follow_up_value
=
portal
.
restrictedTraverse
(
follow_up
)
assert
follow_up_value
.
getPortalType
()
==
"Support Request"
...
...
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequestModule_generateRSSLinkAsJson.py
View file @
70d38eee
from
zExceptions
import
Unauthorized
import
json
absolute_url
=
context
.
absolute_url
()
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/Base_createTranslateData.py
View file @
70d38eee
...
...
@@ -3,15 +3,10 @@ import json
portal
=
context
.
getPortalObject
()
Base_translateString
=
context
.
Base_translateString
#(data-i18n)=["']{{((?:.(?!["']?(?:\S+)=|[>"']))+.)}}["']
attribute_filter_re
=
re
.
compile
(
r"""(data-i18n)=["']?((?:.(?!["']?\
s+(?:
\S+)=|[>"']))+.)["']?"""
)
tmp_re
=
re
.
compile
(
r"""/[{}]/g, """""
)
translate_word
=
[]
for
web_page
in
portal
.
web_page_module
.
searchFolder
(
portal_type
=
'Web Page'
,
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs/Base_getListFileFromAppcache.py
View file @
70d38eee
appcache_
fil
e
=
context
.
getLayoutProperty
(
"configuration_manifest_url"
,
default
=
"gadget_erp5.appcache"
)
appcache_
referenc
e
=
context
.
getLayoutProperty
(
"configuration_manifest_url"
,
default
=
"gadget_erp5.appcache"
)
text_content
=
context
.
getPortalObject
().
portal_catalog
.
getResultValue
(
portal_type
=
'Web Manifest'
,
reference
=
appcache_reference
).
getTextContent
()
text_content
=
context
.
web_page_module
.
searchFolder
(
portal_type
=
'Web Manifest'
,
reference
=
appcache_file
)[
0
].
getTextContent
()
translation_data_file
=
[]
file_list
=
[]
for
file
in
text_content
.
split
(
'
\
n
'
):
file
=
file
.
split
(
'/'
)[
-
1
]
if
file
.
endswith
(
'.html'
):
file_list
.
append
(
file
)
translation_data_url_list
=
[]
url_list
=
[]
for
text_line
in
text_content
.
split
(
'
\
n
'
):
text_line
=
text_line
.
split
(
'/'
)[
-
1
]
if
text_line
.
endswith
(
'.html'
):
url_list
.
append
(
text_line
)
continue
if
fil
e
.
endswith
(
'.js'
)
and
not
only_html
:
if
fil
e
.
endswith
(
'translation_data.js'
):
translation_data_
file
=
[
fil
e
]
if
text_lin
e
.
endswith
(
'.js'
)
and
not
only_html
:
if
text_lin
e
.
endswith
(
'translation_data.js'
):
translation_data_
url_list
=
[
text_lin
e
]
continue
file_list
.
append
(
fil
e
)
return
translation_data_
file
+
file
_list
url_list
.
append
(
text_lin
e
)
return
translation_data_
url_list
+
url
_list
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/File_viewAsWeb.py
View file @
70d38eee
...
...
@@ -3,8 +3,8 @@ if REQUEST is None:
if
response
is
None
:
response
=
REQUEST
.
RESPONSE
file
=
context
file_content
=
file
.
getData
()
file
_document
=
context
file_content
=
file
_document
.
getData
()
# The vanilla HTML is wanted
response
.
setBase
(
None
)
...
...
@@ -12,7 +12,7 @@ response.setBase(None)
# Allow any external app to download the source code
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
"*"
)
if
REQUEST
.
getHeader
(
'If-Modified-Since'
,
''
)
==
file
.
getModificationDate
().
rfc822
():
if
REQUEST
.
getHeader
(
'If-Modified-Since'
,
''
)
==
file
_document
.
getModificationDate
().
rfc822
():
response
.
setStatus
(
304
)
return
""
...
...
@@ -20,6 +20,6 @@ if REQUEST.getHeader('If-Modified-Since', '') == file.getModificationDate().rfc8
#if file_content_type is None:
# file_content_type = 'application/octet-stream'
response
.
setHeader
(
'Content-Type'
,
(
file
.
getContentType
()
or
'application/octet-stream'
))
response
.
setHeader
(
'Content-Type'
,
(
file
_document
.
getContentType
()
or
'application/octet-stream'
))
return
file_content
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderDefaultPageAsGadget.py
View file @
70d38eee
...
...
@@ -89,6 +89,6 @@ else:
background-attachment: fixed;
background-image: url("%s");
}
"""
%
wallpaper_url
)
;
"""
%
wallpaper_url
)
return
view_as_web_method
(
mapping_dict
=
mapping_dict
)
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSite_logout.py
View file @
70d38eee
"""
Default logout handler, overwritten to give website specific portal status message.
"""
website
=
context
.
getWebSiteValue
()
REQUEST
=
context
.
REQUEST
if
REQUEST
.
has_key
(
'portal_skin'
):
context
.
portal_skins
.
clearSkinCookie
()
...
...
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/ERP5Site_createPersonToAskAccountRecover.py
View file @
70d38eee
alpha
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
new_password
=
''
.
join
([
random
.
choice
(
alpha
)
for
i
in
range
(
10
)])
new_password
=
''
.
join
([
random
.
choice
(
alpha
)
for
_
in
range
(
10
)])
person_module
=
context
.
getPortalObject
().
person_module
user_id
=
"user_a_test"
...
...
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