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
1
Issues
1
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
Roque
erp5
Commits
1a801662
Commit
1a801662
authored
Jan 29, 2014
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename SelectionTool._isAnonymous to SelectionTool.isAnonymous.
so that we can call it from restricted environment.
parent
5fcc42c2
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+1
-1
product/ERP5Form/Tool/SelectionTool.py
product/ERP5Form/Tool/SelectionTool.py
+7
-7
product/ERP5Form/tests/testSelectionTool.py
product/ERP5Form/tests/testSelectionTool.py
+1
-1
product/ERP5Type/tests/testFunctionalAnonymousSelection.py
product/ERP5Type/tests/testFunctionalAnonymousSelection.py
+2
-2
No files found.
product/ERP5Form/ListBox.py
View file @
1a801662
...
...
@@ -2466,7 +2466,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
'selection_index=%s'
%
self
.
index
,
'reset:int=1'
))
selection_tool
=
self
.
getObject
().
getPortalObject
().
portal_selections
if
selection_tool
.
_
isAnonymous
():
if
selection_tool
.
isAnonymous
():
params
.
append
(
'selection_key=%s'
%
selection
.
getAnonymousSelectionKey
())
if
params
:
url
=
'%s?%s'
%
(
url
,
'&'
.
join
(
params
))
...
...
product/ERP5Form/Tool/SelectionTool.py
View file @
1a801662
...
...
@@ -291,7 +291,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
not
selection_name
:
return
None
selection
=
self
.
_getSelectionFromContainer
(
selection_name
)
if
selection
is
None
and
self
.
_
isAnonymous
():
if
selection
is
None
and
self
.
isAnonymous
():
selection_key
=
self
.
_getSelectionKeyFromRequest
(
selection_name
,
REQUEST
)
if
selection_key
is
not
None
:
selection
=
self
.
getAnonymousSelection
(
selection_key
,
selection_name
)
...
...
@@ -317,7 +317,7 @@ class SelectionTool( BaseTool, SimpleItem ):
selection_object
.
name
))
elif
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
!=
selection_object
:
self
.
_setSelectionToContainer
(
selection_name
,
selection_object
)
if
selection_object
is
None
and
self
.
_
isAnonymous
():
if
selection_object
is
None
and
self
.
isAnonymous
():
REQUEST
=
self
.
_getRequest
(
REQUEST
=
REQUEST
)
for
key
in
(
'%s_selection_key'
%
selection_name
,
'selection_key'
):
try
:
...
...
@@ -463,7 +463,7 @@ class SelectionTool( BaseTool, SimpleItem ):
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
if
selection
:
url
=
selection
.
getListUrl
()
if
self
.
_
isAnonymous
()
and
'?'
in
url
:
if
self
.
isAnonymous
()
and
'?'
in
url
:
url
+=
'&selection_key=%s'
%
self
.
_getSelectionKeyFromRequest
(
selection_name
,
REQUEST
)
return
url
else
:
...
...
@@ -733,7 +733,7 @@ class SelectionTool( BaseTool, SimpleItem ):
url += '
?
selection_index
=%
s
&
selection_name
=%
s
' % (selection_index, selection_name)
if ignore_layout:
url += '
&
ignore_layout
:
int
=
1
'
if self.
_
isAnonymous():
if self.isAnonymous():
url += '
&
selection_key
=%
s
' % self.getAnonymousSelectionKey(selection_name, REQUEST=REQUEST)
REQUEST.RESPONSE.redirect(url)
...
...
@@ -1461,7 +1461,7 @@ class SelectionTool( BaseTool, SimpleItem ):
return
container
.
getSelection
(
key
,
selection_name
)
def
getAnonymousSelectionKey
(
self
,
selection_name
,
REQUEST
=
None
):
if
not
self
.
_
isAnonymous
():
if
not
self
.
isAnonymous
():
return
''
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
if
selection
is
None
:
...
...
@@ -1514,11 +1514,11 @@ class SelectionTool( BaseTool, SimpleItem ):
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
\
self
.
getTemporarySelectionDict
().
keys
()))
def
_
isAnonymous
(
self
):
def
isAnonymous
(
self
):
return
self
.
_getUserId
()
==
'Anonymous User'
def
_getContainer
(
self
):
if
self
.
_
isAnonymous
():
if
self
.
isAnonymous
():
tv
=
getTransactionalVariable
()
storage
=
tv
.
setdefault
(
'_transactional_selection_container'
,
{})
container
=
TransactionalCacheContainer
(
storage
)
...
...
product/ERP5Form/tests/testSelectionTool.py
View file @
1a801662
...
...
@@ -247,7 +247,7 @@ class TestSelectionPersistence(unittest.TestCase):
# find the current user name
SelectionTool
.
_getUserId_saved
=
SelectionTool
.
_getUserId
SelectionTool
.
_getUserId
=
lambda
self
:
'user'
SelectionTool
.
_
isAnonymous
=
lambda
self
:
0
SelectionTool
.
isAnonymous
=
lambda
self
:
0
self
.
db
=
ZODB
.
DB
(
ZODB
.
DemoStorage
.
DemoStorage
())
self
.
cnx
=
self
.
db
.
open
()
...
...
product/ERP5Type/tests/testFunctionalAnonymousSelection.py
View file @
1a801662
...
...
@@ -30,9 +30,9 @@ import unittest
from
Products.ERP5Type.tests.testFunctionalCore
import
\
TestZeleniumCore
# monkey patch SelectionTool.
_
isAnonymous to render as anonymous selection.
# monkey patch SelectionTool.isAnonymous to render as anonymous selection.
from
Products.ERP5Form.Tool.SelectionTool
import
SelectionTool
SelectionTool
.
_
isAnonymous
=
lambda
*
args
,
**
kw
:
True
SelectionTool
.
isAnonymous
=
lambda
*
args
,
**
kw
:
True
class
TestAnonymousSelection
(
TestZeleniumCore
):
foreground
=
0
...
...
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