Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compound
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
compound
Commits
09d13e5869ac
Commit
09d13e5869ac
authored
8 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
Extract part of CloneAction.url into a linkto_clone_url_params function
and test it.
parent
b4c29f63b187
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/test_compound.py
+1
-0
1 addition, 0 deletions
test/test_compound.py
views.py
+7
-3
7 additions, 3 deletions
views.py
with
8 additions
and
3 deletions
test/test_compound.py
+
1
−
0
View file @
09d13e58
...
@@ -371,6 +371,7 @@
...
@@ -371,6 +371,7 @@
action
=
self
.
vreg
[
'
actions
'
].
select
(
'
copy
'
,
req
,
action
=
self
.
vreg
[
'
actions
'
].
select
(
'
copy
'
,
req
,
rset
=
entity
.
as_rset
())
rset
=
entity
.
as_rset
())
self
.
assertIsInstance
(
action
,
CloneAction
)
self
.
assertIsInstance
(
action
,
CloneAction
)
self
.
assertIn
(
'
clone_of
'
,
action
.
url
())
@staticmethod
@staticmethod
def
_clone_setup
(
cnx
):
def
_clone_setup
(
cnx
):
...
...
This diff is collapsed.
Click to expand it.
views.py
+
7
−
3
View file @
09d13e58
...
@@ -25,6 +25,12 @@
...
@@ -25,6 +25,12 @@
from
cubes.compound.entities
import
copy_entity
from
cubes.compound.entities
import
copy_entity
def
linkto_clone_url_params
(
entity
):
iclone
=
entity
.
cw_adapt_to
(
'
IClonable
'
)
linkto
=
'
%s:%s:%s
'
%
(
iclone
.
rtype
,
entity
.
eid
,
neg_role
(
iclone
.
role
))
return
{
'
__linkto
'
:
linkto
}
class
CloneAction
(
actions
.
CopyAction
):
class
CloneAction
(
actions
.
CopyAction
):
"""
Abstract clone action of ICloneable entities.
"""
Abstract clone action of ICloneable entities.
...
@@ -40,9 +46,7 @@
...
@@ -40,9 +46,7 @@
def
url
(
self
):
def
url
(
self
):
entity
=
self
.
cw_rset
.
get_entity
(
self
.
cw_row
or
0
,
self
.
cw_col
or
0
)
entity
=
self
.
cw_rset
.
get_entity
(
self
.
cw_row
or
0
,
self
.
cw_col
or
0
)
iclone
=
entity
.
cw_adapt_to
(
'
IClonable
'
)
return
entity
.
absolute_url
(
vid
=
'
copy
'
,
**
linkto_clone_url_params
(
entity
))
linkto
=
'
%s:%s:%s
'
%
(
iclone
.
rtype
,
entity
.
eid
,
neg_role
(
iclone
.
role
))
return
entity
.
absolute_url
(
vid
=
'
copy
'
,
__linkto
=
linkto
)
# In any case IClonable entities want default copy disabled since it wont handle
# In any case IClonable entities want default copy disabled since it wont handle
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment