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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
erp5
Commits
6e9a7048
Commit
6e9a7048
authored
May 17, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make $(Property)Getter reuse ValueGetter
parent
836a3594
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
200 deletions
+49
-200
product/ERP5Type/Accessor/Value.py
product/ERP5Type/Accessor/Value.py
+49
-200
No files found.
product/ERP5Type/Accessor/Value.py
View file @
6e9a7048
...
...
@@ -163,30 +163,12 @@ class SetGetter(ListGetter):
return
result_set
class
DefaultTitleGetter
(
BaseGetter
):
"""
Gets a default reference object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,
)
func_code
.
co_argcount
=
1
func_defaults
=
()
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
class
DefaultTitleGetter
(
DefaultGetter
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
o
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
**
kw
)
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getTitle
()
psyco
.
bind
(
__call__
)
class
TitleListGetter
(
ListGetter
):
...
...
@@ -228,34 +210,12 @@ class TranslatedTitleSetGetter(TranslatedTitleListGetter):
return
result_set
class
DefaultReferenceGetter
(
BaseGetter
):
"""
Gets a default reference object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,
)
func_code
.
co_argcount
=
1
func_defaults
=
()
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
class
DefaultReferenceGetter
(
DefaultGetter
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
o
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getReference
()
psyco
.
bind
(
__call__
)
class
ReferenceListGetter
(
ListGetter
):
...
...
@@ -274,37 +234,13 @@ class ReferenceSetGetter(ReferenceListGetter):
return
result_set
class
DefaultUidGetter
(
BaseGetter
):
"""
Gets a default reference object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,)
func_code
.
co_argcount
=
1
func_defaults
=
()
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
class
DefaultUidGetter
(
DefaultGetter
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
value
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
if
value
is
not
None
:
return
value
.
getUid
()
else
:
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getUid
()
psyco
.
bind
(
__call__
)
UidGetter
=
DefaultUidGetter
class
UidListGetter
(
ListGetter
):
...
...
@@ -382,98 +318,33 @@ class UidDefaultSetter(UidSetSetter):
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
return
(
instance
,
)
class
DefaultIdGetter
(
BaseGetter
):
"""
Gets a default reference object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,)
func_code
.
co_argcount
=
1
func_defaults
=
()
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
class
DefaultIdGetter
(
DefaultGetter
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
value
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
if
value
is
not
None
:
return
value
.
getId
()
else
:
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getId
()
psyco
.
bind
(
__call__
)
IdGetter
=
DefaultIdGetter
class
DefaultTitleOrIdGetter
(
BaseGetter
):
"""
Gets a default reference object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,)
func_code
.
co_argcount
=
1
func_defaults
=
()
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
class
DefaultTitleOrIdGetter
(
DefaultGetter
):
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
value
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
if
value
is
not
None
:
return
value
.
getTitleOrId
()
else
:
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getTitleOrId
()
psyco
.
bind
(
__call__
)
TitleOrIdGetter
=
DefaultTitleOrIdGetter
class
DefaultLogicalPathGetter
(
BaseGetter
):
"""
Gets a default logical path object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,)
func_code
.
co_argcount
=
1
func_defaults
=
()
class
DefaultLogicalPathGetter
(
DefaultGetter
):
_item_method
=
'getTitle'
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
def
__call__
(
self
,
instance
,
*
args
,
**
kw
):
value
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
if
value
is
not
None
:
return
value
.
getLogicalPath
(
item_method
=
self
.
_item_method
)
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getLogicalPath
(
item_method
=
self
.
_item_method
)
psyco
.
bind
(
__call__
)
LogicalPathGetter
=
DefaultLogicalPathGetter
...
...
@@ -516,34 +387,12 @@ class LogicalPathSetGetter(LogicalPathListGetter):
return
result_set
class
DefaultPropertyGetter
(
BaseGetter
):
"""
Gets a default reference object
"""
_need__name__
=
1
# Generic Definition of Method Object
# This is required to call the method form the Web
func_code
=
func_code
()
func_code
.
co_varnames
=
(
'self'
,)
func_code
.
co_argcount
=
1
func_defaults
=
()
def
__init__
(
self
,
id
,
key
):
self
.
_id
=
id
self
.
__name__
=
id
self
.
_key
=
key
class
DefaultPropertyGetter
(
DefaultGetter
):
def
__call__
(
self
,
instance
,
key
,
*
args
,
**
kw
):
value
=
instance
.
_getDefaultAcquiredValue
(
self
.
_key
,
spec
=
kw
.
get
(
'spec'
,()),
filter
=
kw
.
get
(
'filter'
,
None
),
portal_type
=
kw
.
get
(
'portal_type'
,()),
checked_permission
=
kw
.
get
(
'checked_permission'
,
None
))
if
value
is
not
None
:
return
value
.
getProperty
(
key
)
else
:
o
=
DefaultGetter
.
__call__
(
self
,
instance
,
*
args
,
**
kw
)
if
o
is
None
:
return
None
return
o
.
getProperty
(
key
)
psyco
.
bind
(
__call__
)
...
...
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