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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
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
Hide 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):
...
@@ -2466,7 +2466,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
'selection_index=%s'
%
self
.
index
,
'selection_index=%s'
%
self
.
index
,
'reset:int=1'
))
'reset:int=1'
))
selection_tool
=
self
.
getObject
().
getPortalObject
().
portal_selections
selection_tool
=
self
.
getObject
().
getPortalObject
().
portal_selections
if
selection_tool
.
_
isAnonymous
():
if
selection_tool
.
isAnonymous
():
params
.
append
(
'selection_key=%s'
%
selection
.
getAnonymousSelectionKey
())
params
.
append
(
'selection_key=%s'
%
selection
.
getAnonymousSelectionKey
())
if
params
:
if
params
:
url
=
'%s?%s'
%
(
url
,
'&'
.
join
(
params
))
url
=
'%s?%s'
%
(
url
,
'&'
.
join
(
params
))
...
...
product/ERP5Form/Tool/SelectionTool.py
View file @
1a801662
...
@@ -291,7 +291,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -291,7 +291,7 @@ class SelectionTool( BaseTool, SimpleItem ):
if
not
selection_name
:
if
not
selection_name
:
return
None
return
None
selection
=
self
.
_getSelectionFromContainer
(
selection_name
)
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
)
selection_key
=
self
.
_getSelectionKeyFromRequest
(
selection_name
,
REQUEST
)
if
selection_key
is
not
None
:
if
selection_key
is
not
None
:
selection
=
self
.
getAnonymousSelection
(
selection_key
,
selection_name
)
selection
=
self
.
getAnonymousSelection
(
selection_key
,
selection_name
)
...
@@ -317,7 +317,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -317,7 +317,7 @@ class SelectionTool( BaseTool, SimpleItem ):
selection_object
.
name
))
selection_object
.
name
))
elif
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
!=
selection_object
:
elif
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
!=
selection_object
:
self
.
_setSelectionToContainer
(
selection_name
,
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
)
REQUEST
=
self
.
_getRequest
(
REQUEST
=
REQUEST
)
for
key
in
(
'%s_selection_key'
%
selection_name
,
'selection_key'
):
for
key
in
(
'%s_selection_key'
%
selection_name
,
'selection_key'
):
try
:
try
:
...
@@ -463,7 +463,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -463,7 +463,7 @@ class SelectionTool( BaseTool, SimpleItem ):
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
if
selection
:
if
selection
:
url
=
selection
.
getListUrl
()
url
=
selection
.
getListUrl
()
if
self
.
_
isAnonymous
()
and
'?'
in
url
:
if
self
.
isAnonymous
()
and
'?'
in
url
:
url
+=
'&selection_key=%s'
%
self
.
_getSelectionKeyFromRequest
(
selection_name
,
REQUEST
)
url
+=
'&selection_key=%s'
%
self
.
_getSelectionKeyFromRequest
(
selection_name
,
REQUEST
)
return
url
return
url
else
:
else
:
...
@@ -733,7 +733,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -733,7 +733,7 @@ class SelectionTool( BaseTool, SimpleItem ):
url += '
?
selection_index
=%
s
&
selection_name
=%
s
' % (selection_index, selection_name)
url += '
?
selection_index
=%
s
&
selection_name
=%
s
' % (selection_index, selection_name)
if ignore_layout:
if ignore_layout:
url += '
&
ignore_layout
:
int
=
1
'
url += '
&
ignore_layout
:
int
=
1
'
if self.
_
isAnonymous():
if self.isAnonymous():
url += '
&
selection_key
=%
s
' % self.getAnonymousSelectionKey(selection_name, REQUEST=REQUEST)
url += '
&
selection_key
=%
s
' % self.getAnonymousSelectionKey(selection_name, REQUEST=REQUEST)
REQUEST.RESPONSE.redirect(url)
REQUEST.RESPONSE.redirect(url)
...
@@ -1461,7 +1461,7 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -1461,7 +1461,7 @@ class SelectionTool( BaseTool, SimpleItem ):
return
container
.
getSelection
(
key
,
selection_name
)
return
container
.
getSelection
(
key
,
selection_name
)
def
getAnonymousSelectionKey
(
self
,
selection_name
,
REQUEST
=
None
):
def
getAnonymousSelectionKey
(
self
,
selection_name
,
REQUEST
=
None
):
if
not
self
.
_
isAnonymous
():
if
not
self
.
isAnonymous
():
return
''
return
''
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
selection
=
self
.
getSelectionFor
(
selection_name
,
REQUEST
=
REQUEST
)
if
selection
is
None
:
if
selection
is
None
:
...
@@ -1514,11 +1514,11 @@ class SelectionTool( BaseTool, SimpleItem ):
...
@@ -1514,11 +1514,11 @@ class SelectionTool( BaseTool, SimpleItem ):
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
\
return
list
(
set
(
self
.
_getContainer
().
getSelectionNameList
(
user_id
)
+
\
self
.
getTemporarySelectionDict
().
keys
()))
self
.
getTemporarySelectionDict
().
keys
()))
def
_
isAnonymous
(
self
):
def
isAnonymous
(
self
):
return
self
.
_getUserId
()
==
'Anonymous User'
return
self
.
_getUserId
()
==
'Anonymous User'
def
_getContainer
(
self
):
def
_getContainer
(
self
):
if
self
.
_
isAnonymous
():
if
self
.
isAnonymous
():
tv
=
getTransactionalVariable
()
tv
=
getTransactionalVariable
()
storage
=
tv
.
setdefault
(
'_transactional_selection_container'
,
{})
storage
=
tv
.
setdefault
(
'_transactional_selection_container'
,
{})
container
=
TransactionalCacheContainer
(
storage
)
container
=
TransactionalCacheContainer
(
storage
)
...
...
product/ERP5Form/tests/testSelectionTool.py
View file @
1a801662
...
@@ -247,7 +247,7 @@ class TestSelectionPersistence(unittest.TestCase):
...
@@ -247,7 +247,7 @@ class TestSelectionPersistence(unittest.TestCase):
# find the current user name
# find the current user name
SelectionTool
.
_getUserId_saved
=
SelectionTool
.
_getUserId
SelectionTool
.
_getUserId_saved
=
SelectionTool
.
_getUserId
SelectionTool
.
_getUserId
=
lambda
self
:
'user'
SelectionTool
.
_getUserId
=
lambda
self
:
'user'
SelectionTool
.
_
isAnonymous
=
lambda
self
:
0
SelectionTool
.
isAnonymous
=
lambda
self
:
0
self
.
db
=
ZODB
.
DB
(
ZODB
.
DemoStorage
.
DemoStorage
())
self
.
db
=
ZODB
.
DB
(
ZODB
.
DemoStorage
.
DemoStorage
())
self
.
cnx
=
self
.
db
.
open
()
self
.
cnx
=
self
.
db
.
open
()
...
...
product/ERP5Type/tests/testFunctionalAnonymousSelection.py
View file @
1a801662
...
@@ -30,9 +30,9 @@ import unittest
...
@@ -30,9 +30,9 @@ import unittest
from
Products.ERP5Type.tests.testFunctionalCore
import
\
from
Products.ERP5Type.tests.testFunctionalCore
import
\
TestZeleniumCore
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
from
Products.ERP5Form.Tool.SelectionTool
import
SelectionTool
SelectionTool
.
_
isAnonymous
=
lambda
*
args
,
**
kw
:
True
SelectionTool
.
isAnonymous
=
lambda
*
args
,
**
kw
:
True
class
TestAnonymousSelection
(
TestZeleniumCore
):
class
TestAnonymousSelection
(
TestZeleniumCore
):
foreground
=
0
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