Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
seda
Commits
8e833a9015e2
Commit
2420fa5c
authored
Oct 17, 2016
by
Sylvain Thénault
Browse files
Fix format_supported selector to consider if a profile is simplified or not
parent
44879714e928
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/test_views.py
View file @
8e833a90
...
...
@@ -157,7 +157,8 @@ class FormatSupportedPredicateTC(CubicWebTC):
predicate
=
export
.
format_supported
()
with
self
.
admin_access
.
web_request
()
as
req
:
transfer
=
req
.
create_entity
(
'SEDAArchiveTransfer'
,
title
=
u
'Test widget'
)
transfer
=
req
.
create_entity
(
'SEDAArchiveTransfer'
,
title
=
u
'Test widget'
,
simplified_profile
=
True
)
req
.
cnx
.
commit
()
for
seda_version
in
(
'2.0'
,
'1.0'
,
'0.2'
):
...
...
@@ -196,6 +197,14 @@ class FormatSupportedPredicateTC(CubicWebTC):
self
.
assertEqual
(
predicate
(
None
,
req
,
entity
=
transfer
,
version
=
'1.0'
),
0
)
transfer
.
cw_set
(
simplified_profile
=
False
)
req
.
cnx
.
commit
()
# will reset compat_list
self
.
assertEqual
(
predicate
(
None
,
req
,
entity
=
transfer
,
version
=
'2.0'
),
1
)
self
.
assertEqual
(
predicate
(
None
,
req
,
entity
=
transfer
,
version
=
'1.0'
),
0
)
class
ArchiveTransferDiagnoseTabTC
(
CubicWebTC
):
...
...
@@ -212,7 +221,8 @@ class ArchiveTransferExportTC(CubicWebTC):
def
test_selected_export_class
(
self
):
with
self
.
admin_access
.
web_request
()
as
req
:
transfer
=
req
.
create_entity
(
'SEDAArchiveTransfer'
,
title
=
u
'diagnosis testing'
)
transfer
=
req
.
create_entity
(
'SEDAArchiveTransfer'
,
title
=
u
'diagnosis testing'
,
simplified_profile
=
True
)
unit
,
unit_alt
,
unit_alt_seq
=
create_archive_unit
(
transfer
)
req
.
cnx
.
commit
()
...
...
views/export.py
View file @
8e833a90
...
...
@@ -31,6 +31,8 @@ def format_supported(cls, req, rset=None, entity=None, **kwargs):
if
entity
is
None
:
entity
=
rset
.
get_entity
(
0
,
0
)
version
=
getattr
(
cls
,
'seda_version'
,
kwargs
.
get
(
'version'
,
req
.
form
.
get
(
'version'
,
'2.0'
)))
if
version
!=
'2.0'
and
not
entity
.
simplified_profile
:
return
0
return
int
((
'SEDA '
+
version
)
in
entity
.
formats_compat
)
...
...
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