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
cubicweb
Commits
deb13e88e037
Commit
ab6656c3
authored
Oct 15, 2009
by
Sylvain Thénault
Browse files
follow yams 0.25 api changes to improve performance
--HG-- branch : stable
parent
421fb447ecb2
Changes
65
Hide whitespace changes
Inline
Side-by-side
devtools/devctl.py
View file @
deb13e88
...
...
@@ -144,13 +144,13 @@ def _generate_schema_pot(w, vreg, schema, libconfig=None, cube=None):
if
etype
not
in
libschema
:
add_msg
(
w
,
etype
)
add_msg
(
w
,
'%s_plural'
%
etype
)
if
not
eschema
.
is_
final
()
:
if
not
eschema
.
final
:
add_msg
(
w
,
'This %s'
%
etype
)
add_msg
(
w
,
'New %s'
%
etype
)
if
eschema
.
description
and
not
eschema
.
description
in
done
:
done
.
add
(
eschema
.
description
)
add_msg
(
w
,
eschema
.
description
)
if
eschema
.
is_
final
()
:
if
eschema
.
final
:
continue
for
rschema
,
targetschemas
,
role
in
eschema
.
relation_definitions
(
True
):
for
tschema
in
targetschemas
:
...
...
@@ -199,7 +199,7 @@ def _generate_schema_pot(w, vreg, schema, libconfig=None, cube=None):
for
subjschema
in
rschema
.
subjects
():
if
not
subjschema
in
libsubjects
:
add_msg
(
w
,
rtype
,
subjschema
.
type
)
if
not
(
schema
.
rschema
(
rtype
).
is_
final
()
or
rschema
.
symetric
):
if
not
(
schema
.
rschema
(
rtype
).
final
or
rschema
.
symetric
):
if
rschema
not
in
no_context_rtypes
:
libobjects
=
librschema
and
librschema
.
objects
()
or
()
for
objschema
in
rschema
.
objects
():
...
...
devtools/fill.py
View file @
deb13e88
...
...
@@ -347,7 +347,7 @@ class RelationsQueriesGenerator(object):
queries
=
[]
# 1/ skip final relations and explictly ignored relations
rels
=
[
rschema
for
rschema
in
self
.
schema
.
relations
()
if
not
(
rschema
.
is_
final
()
or
rschema
in
ignored_relations
)]
if
not
(
rschema
.
final
or
rschema
in
ignored_relations
)]
# for each relation
# 2/ take each possible couple (subj, obj)
# 3/ analyze cardinality of relation
...
...
devtools/testlib.py
View file @
deb13e88
...
...
@@ -44,7 +44,7 @@ def how_many_dict(schema, cursor, how_many, skip):
# compute how many entities by type we need to be able to satisfy relation constraint
relmap
=
{}
for
rschema
in
schema
.
relations
():
if
rschema
.
is_
final
()
:
if
rschema
.
final
:
continue
for
subj
,
obj
in
rschema
.
iter_rdefs
():
card
=
rschema
.
rproperty
(
subj
,
obj
,
'cardinality'
)
...
...
@@ -143,7 +143,7 @@ class WebTest(EnvBasedTC):
existingrels
=
{}
ignored_relations
=
SYSTEM_RELATIONS
+
self
.
ignored_relations
for
rschema
in
self
.
schema
.
relations
():
if
rschema
.
is_
final
()
or
rschema
in
ignored_relations
:
if
rschema
.
final
or
rschema
in
ignored_relations
:
continue
rset
=
cu
.
execute
(
'DISTINCT Any X,Y WHERE X %s Y'
%
rschema
)
existingrels
.
setdefault
(
rschema
.
type
,
set
()).
update
((
x
,
y
)
for
x
,
y
in
rset
)
...
...
entities/__init__.py
View file @
deb13e88
...
...
@@ -63,7 +63,7 @@ class AnyEntity(Entity):
def
dc_description
(
self
,
format
=
'text/plain'
):
"""return a suitable description for this entity"""
if
self
.
e_schema
.
has_subject_relation
(
'description'
)
:
if
'description'
in
self
.
e_schema
.
subjrels
:
return
self
.
printable_value
(
'description'
,
format
=
format
)
return
u
''
...
...
entity.py
View file @
deb13e88
...
...
@@ -238,7 +238,7 @@ class Entity(AppObject, dict):
_fetchattrs
=
[]
for
attr
in
fetchattrs
:
try
:
rschema
=
eschema
.
subj
ect_relation
(
attr
)
rschema
=
eschema
.
subj
rels
[
attr
]
except
KeyError
:
cls
.
warning
(
'skipping fetch_attr %s defined in %s (not found in schema)'
,
attr
,
cls
.
id
)
...
...
@@ -249,7 +249,7 @@ class Entity(AppObject, dict):
selection
.
append
(
var
)
restriction
=
'%s %s %s'
%
(
mainvar
,
attr
,
var
)
restrictions
.
append
(
restriction
)
if
not
rschema
.
is_
final
()
:
if
not
rschema
.
final
:
# XXX this does not handle several destination types
desttype
=
rschema
.
objects
(
eschema
.
type
)[
0
]
card
=
rschema
.
rproperty
(
eschema
,
desttype
,
'cardinality'
)[
0
]
...
...
@@ -290,7 +290,7 @@ class Entity(AppObject, dict):
needcheck
=
not
cls
.
e_schema
.
has_unique_values
(
mainattr
)
else
:
for
rschema
in
cls
.
e_schema
.
subject_relations
():
if
rschema
.
is_
final
()
and
rschema
!=
'eid'
and
cls
.
e_schema
.
has_unique_values
(
rschema
):
if
rschema
.
final
and
rschema
!=
'eid'
and
cls
.
e_schema
.
has_unique_values
(
rschema
):
mainattr
=
str
(
rschema
)
needcheck
=
False
break
...
...
@@ -487,7 +487,7 @@ class Entity(AppObject, dict):
assert
self
.
has_eid
()
execute
=
self
.
req
.
execute
for
rschema
in
self
.
e_schema
.
subject_relations
():
if
rschema
.
is_
final
()
or
rschema
.
meta
:
if
rschema
.
final
or
rschema
.
meta
:
continue
# skip already defined relations
if
getattr
(
self
,
rschema
.
type
):
...
...
@@ -535,7 +535,7 @@ class Entity(AppObject, dict):
def
to_complete_relations
(
self
):
"""by default complete final relations to when calling .complete()"""
for
rschema
in
self
.
e_schema
.
subject_relations
():
if
rschema
.
is_
final
()
:
if
rschema
.
final
:
continue
if
len
(
rschema
.
objects
(
self
.
e_schema
))
>
1
:
# ambigous relations, the querier doesn't handle
...
...
goa/__init__.py
View file @
deb13e88
...
...
@@ -65,7 +65,7 @@ else:
edef
.
name
=
edef
.
name
.
encode
()
assert
re
.
match
(
r
'[A-Z][A-Za-z0-9]*[a-z]+[0-9]*$'
,
edef
.
name
),
repr
(
edef
.
name
)
eschema
=
super
(
CubicWebSchema
,
self
).
add_entity_type
(
edef
)
if
not
eschema
.
is_
final
()
:
if
not
eschema
.
final
:
# automatically add the eid relation to non final entity types
rdef
=
ybo
.
RelationDefinition
(
eschema
.
type
,
'eid'
,
'Bytes'
,
cardinality
=
'?1'
,
uid
=
True
)
...
...
goa/appobjects/components.py
View file @
deb13e88
...
...
@@ -67,7 +67,7 @@ def entity_types_no_count(self, eschemas):
"""
req
=
self
.
req
for
eschema
in
eschemas
:
if
eschema
.
is_
final
()
or
not
(
eschema
.
has_perm
(
req
,
'read'
)
or
if
eschema
.
final
or
not
(
eschema
.
has_perm
(
req
,
'read'
)
or
eschema
.
has_local_role
(
'read'
)):
continue
etype
=
eschema
.
type
...
...
goa/appobjects/dbmgmt.py
View file @
deb13e88
...
...
@@ -175,7 +175,7 @@ class ContentClear(StartupView):
# XXX should use unsafe_execute with all hooks deactivated
# XXX step by catching datastore errors?
for
eschema
in
self
.
schema
.
entities
():
if
eschema
.
is_
final
()
or
eschema
in
self
.
skip_etypes
:
if
eschema
.
final
or
eschema
in
self
.
skip_etypes
:
continue
self
.
req
.
execute
(
'DELETE %s X'
%
eschema
)
self
.
w
(
u
'deleted all %s entities<br/>'
%
eschema
)
...
...
goa/db.py
View file @
deb13e88
...
...
@@ -147,7 +147,7 @@ class Model(entities.AnyEntity):
def
__initialize__
(
cls
):
super
(
Model
,
cls
).
__initialize__
()
cls
.
_attributes
=
frozenset
(
rschema
for
rschema
in
cls
.
e_schema
.
subject_relations
()
if
rschema
.
is_
final
()
)
if
rschema
.
final
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
# db.Model prototype:
...
...
@@ -162,7 +162,7 @@ class Model(entities.AnyEntity):
super
(
Model
,
self
).
__init__
(
None
,
None
)
# if Model instances are given in kwargs, turn them into db model
for
key
,
val
in
kwargs
.
iteritems
():
if
key
in
self
.
e_schema
.
subject_relations
()
and
not
self
.
e_schema
.
schema
[
key
].
is_
final
()
:
if
key
in
self
.
e_schema
.
subject_relations
()
and
not
self
.
e_schema
.
schema
[
key
].
final
:
if
isinstance
(
kwargs
,
(
list
,
tuple
)):
val
=
[
isinstance
(
x
,
Model
)
and
x
.
_dbmodel
or
x
for
x
in
val
]
elif
isinstance
(
val
,
Model
):
...
...
goa/dbinit.py
View file @
deb13e88
...
...
@@ -90,7 +90,7 @@ def init_persistent_schema(ssession, schema):
eschema
=
schema
.
eschema
(
'CWEType'
)
execute
(
rql
,
{
'name'
:
u
'CWEType'
,
'descr'
:
unicode
(
eschema
.
description
)})
for
eschema
in
schema
.
entities
():
if
eschema
.
is_
final
()
or
eschema
==
'CWEType'
:
if
eschema
.
final
or
eschema
==
'CWEType'
:
continue
execute
(
rql
,
{
'name'
:
unicode
(
eschema
),
'descr'
:
unicode
(
eschema
.
description
)})
...
...
goa/overrides/rqlannotation.py
View file @
deb13e88
...
...
@@ -13,7 +13,7 @@ class SQLGenAnnotator(object):
def
__init__
(
self
,
schema
):
self
.
schema
=
schema
self
.
nfdomain
=
frozenset
(
eschema
.
type
for
eschema
in
schema
.
entities
()
if
not
eschema
.
is_
final
()
)
if
not
eschema
.
final
)
def
annotate
(
self
,
rqlst
):
rqlst
.
has_text_query
=
False
rqlst
.
need_distinct
=
False
...
...
goa/rqlinterpreter.py
View file @
deb13e88
...
...
@@ -156,7 +156,7 @@ class VariableSelection(Restriction):
myvar
=
self
.
rhs
.
name
ovar
=
self
.
var
.
name
rtype
=
self
.
rtype
if
self
.
schema
.
rschema
(
rtype
).
is_
final
()
:
if
self
.
schema
.
rschema
(
rtype
).
final
:
# should be detected by rql.stcheck: "Any C WHERE NOT X attr C" doesn't make sense
#if self._not:
# raise NotImplementedError()
...
...
@@ -595,7 +595,7 @@ class RQLInterpreter(object):
# ok, we *may* process this Not node (not implemented error will be
# raised later if we can't)
extra
[
node
.
parent
]
=
True
if
rschema
.
is_
final
()
:
if
rschema
.
final
:
self
.
_visit_final_relation
(
rschema
,
node
,
constraints
,
extra
)
elif
neged
:
self
.
_visit_non_final_neged_relation
(
rschema
,
node
,
constraints
)
...
...
rqlrewrite.py
View file @
deb13e88
...
...
@@ -32,7 +32,7 @@ def add_types_restriction(schema, rqlst, newroot=None, solutions=None):
allpossibletypes
=
{}
for
solution
in
solutions
:
for
varname
,
etype
in
solution
.
iteritems
():
if
not
varname
in
newroot
.
defined_vars
or
eschema
(
etype
).
is_
final
()
:
if
not
varname
in
newroot
.
defined_vars
or
eschema
(
etype
).
final
:
continue
allpossibletypes
.
setdefault
(
varname
,
set
()).
add
(
etype
)
for
varname
in
sorted
(
allpossibletypes
):
...
...
@@ -289,7 +289,7 @@ class RQLRewriter(object):
stinfo
=
self
.
varinfo
[
'stinfo'
]
for
rel
in
stinfo
[
'relations'
]:
rschema
=
self
.
schema
.
rschema
(
rel
.
r_type
)
if
rschema
.
is_
final
()
or
(
rschema
.
inlined
and
if
rschema
.
final
or
(
rschema
.
inlined
and
not
rel
in
stinfo
[
'rhsrelations'
]):
self
.
select
.
remove_node
(
rel
)
rel
.
children
[
0
].
name
=
selectvar
...
...
rset.py
View file @
deb13e88
...
...
@@ -345,7 +345,7 @@ class ResultSet(object):
etype
=
self
.
description
[
row
][
col
]
try
:
eschema
=
self
.
vreg
.
schema
.
eschema
(
etype
)
if
eschema
.
is_
final
()
:
if
eschema
.
final
:
raise
NotAnEntity
(
etype
)
except
KeyError
:
raise
NotAnEntity
(
etype
)
...
...
@@ -409,14 +409,14 @@ class ResultSet(object):
if
outerselidx
is
None
:
continue
if
x
==
'subject'
:
rschema
=
eschema
.
subj
ect_relation
(
attr
)
if
rschema
.
is_
final
()
:
rschema
=
eschema
.
subj
rels
[
attr
]
if
rschema
.
final
:
entity
[
attr
]
=
rowvalues
[
outerselidx
]
continue
tetype
=
rschema
.
objects
(
etype
)[
0
]
card
=
rschema
.
rproperty
(
etype
,
tetype
,
'cardinality'
)[
0
]
else
:
rschema
=
eschema
.
obj
ect_relation
(
attr
)
rschema
=
eschema
.
obj
rels
[
attr
]
tetype
=
rschema
.
subjects
(
etype
)[
0
]
card
=
rschema
.
rproperty
(
tetype
,
etype
,
'cardinality'
)[
1
]
# only keep value if it can't be multivalued
...
...
@@ -489,7 +489,7 @@ class ResultSet(object):
locate_query_col
=
col
rqlst
=
self
.
syntax_tree
()
etype
=
self
.
description
[
row
][
col
]
if
self
.
vreg
.
schema
.
eschema
(
etype
).
is_
final
()
:
if
self
.
vreg
.
schema
.
eschema
(
etype
).
final
:
# final type, find a better one to locate the correct subquery
# (ambiguous if possible)
for
i
in
xrange
(
len
(
rqlst
.
children
[
0
].
selection
)):
...
...
@@ -498,7 +498,7 @@ class ResultSet(object):
coletype
=
self
.
description
[
row
][
i
]
if
coletype
is
None
:
continue
if
not
self
.
vreg
.
schema
.
eschema
(
coletype
).
is_
final
()
:
if
not
self
.
vreg
.
schema
.
eschema
(
coletype
).
final
:
etype
=
coletype
locate_query_col
=
i
if
len
(
self
.
column_types
(
i
))
>
1
:
...
...
schema.py
View file @
deb13e88
...
...
@@ -239,7 +239,7 @@ def system_etypes(schema):
"""return system entity types only: skip final, schema and application entities
"""
for
eschema
in
schema
.
entities
():
if
eschema
.
is_
final
()
or
eschema
.
schema_entity
():
if
eschema
.
final
or
eschema
.
schema_entity
():
continue
yield
eschema
.
type
...
...
@@ -301,7 +301,7 @@ class CubicWebEntitySchema(EntitySchema):
may_need_has_text
,
has_has_text
=
False
,
False
need_has_text
=
None
for
rschema
in
self
.
subject_relations
():
if
rschema
.
is_
final
()
:
if
rschema
.
final
:
if
rschema
==
'has_text'
:
has_has_text
=
True
elif
self
.
rproperty
(
rschema
,
'fulltextindexed'
):
...
...
@@ -433,7 +433,7 @@ class CubicWebRelationSchema(RelationSchema):
def
rql_expression
(
self
,
expression
,
mainvars
=
None
,
eid
=
None
):
"""rql expression factory"""
if
self
.
is_
final
()
:
if
self
.
final
:
return
ERQLExpression
(
expression
,
mainvars
,
eid
)
return
RRQLExpression
(
expression
,
mainvars
,
eid
)
...
...
@@ -473,7 +473,7 @@ class CubicWebSchema(Schema):
edef
.
name
=
bw_normalize_etype
(
edef
.
name
)
assert
re
.
match
(
r
'[A-Z][A-Za-z0-9]*[a-z]+[0-9]*$'
,
edef
.
name
),
repr
(
edef
.
name
)
eschema
=
super
(
CubicWebSchema
,
self
).
add_entity_type
(
edef
)
if
not
eschema
.
is_
final
()
:
if
not
eschema
.
final
:
# automatically add the eid relation to non final entity types
rdef
=
ybo
.
RelationDefinition
(
eschema
.
type
,
'eid'
,
'Int'
,
cardinality
=
'11'
,
uid
=
True
)
...
...
schemaviewer.py
View file @
deb13e88
...
...
@@ -47,7 +47,7 @@ class SchemaViewer(object):
klass
=
'titleUnderline'
),))
layout
.
append
(
esection
)
eschemas
=
[
eschema
for
eschema
in
schema
.
entities
()
if
not
(
eschema
.
is_
final
()
or
eschema
in
skiptypes
)]
if
not
(
eschema
.
final
or
eschema
in
skiptypes
)]
for
eschema
in
sorted
(
eschemas
):
esection
.
append
(
self
.
visit_entityschema
(
eschema
,
skiptypes
))
if
display_relations
:
...
...
@@ -55,7 +55,7 @@ class SchemaViewer(object):
rsection
=
Section
(
children
=
(
title
,))
layout
.
append
(
rsection
)
relations
=
[
rschema
for
rschema
in
schema
.
relations
()
if
not
(
rschema
.
is_
final
()
or
rschema
.
type
in
skiptypes
)]
if
not
(
rschema
.
final
or
rschema
.
type
in
skiptypes
)]
keys
=
[(
rschema
.
type
,
rschema
)
for
rschema
in
relations
]
for
key
,
rschema
in
sorted
(
keys
):
relstr
=
self
.
visit_relationschema
(
rschema
)
...
...
@@ -143,7 +143,7 @@ class SchemaViewer(object):
data
.
append
(
Section
(
children
=
rels
,
klass
=
'rels'
))
data
.
append
(
Section
(
children
=
t_vars
,
klass
=
'vars'
))
layout
.
append
(
Section
(
children
=
data
,
klass
=
'entityAttributes'
))
if
eschema
.
is_
final
()
:
# stop here for final entities
if
eschema
.
final
:
# stop here for final entities
return
layout
_
=
self
.
req
.
_
if
self
.
req
.
user
.
matching_groups
(
'managers'
):
...
...
selectors.py
View file @
deb13e88
...
...
@@ -682,9 +682,9 @@ class relation_possible(EClassSelector):
eschema
=
eclass
.
e_schema
try
:
if
self
.
role
==
'object'
:
rschema
=
eschema
.
obj
ect_relation
(
self
.
rtype
)
rschema
=
eschema
.
obj
rels
[
self
.
rtype
]
else
:
rschema
=
eschema
.
subj
ect_relation
(
self
.
rtype
)
rschema
=
eschema
.
subj
rels
[
self
.
rtype
]
except
KeyError
:
return
0
if
self
.
target_etype
is
not
None
:
...
...
@@ -899,7 +899,7 @@ class has_add_permission(EClassSelector):
"""
def
score
(
self
,
cls
,
req
,
etype
):
eschema
=
cls
.
schema
.
eschema
(
etype
)
if
not
(
eschema
.
is_
final
()
or
eschema
.
is_subobject
(
strict
=
True
))
\
if
not
(
eschema
.
final
or
eschema
.
is_subobject
(
strict
=
True
))
\
and
eschema
.
has_perm
(
req
,
'add'
):
return
1
return
0
...
...
server/checkintegrity.py
View file @
deb13e88
...
...
@@ -87,7 +87,7 @@ def reindex_entities(schema, session):
repo
.
do_fti
=
True
# ensure full-text indexation is activated
etypes
=
set
()
for
eschema
in
schema
.
entities
():
if
eschema
.
is_
final
()
:
if
eschema
.
final
:
continue
indexable_attrs
=
tuple
(
eschema
.
indexable_attributes
())
# generator
if
not
indexable_attrs
:
...
...
@@ -165,7 +165,7 @@ def check_entities(schema, session, eids, fix=1):
print
>>
sys
.
stderr
print
'Checking entities tables'
for
eschema
in
schema
.
entities
():
if
eschema
.
is_
final
()
:
if
eschema
.
final
:
continue
table
=
SQL_PREFIX
+
eschema
.
type
column
=
SQL_PREFIX
+
'eid'
...
...
@@ -197,7 +197,7 @@ def check_relations(schema, session, eids, fix=1):
"""check all relations registered in the repo system table"""
print
'Checking relations'
for
rschema
in
schema
.
relations
():
if
rschema
.
is_
final
()
or
rschema
in
PURE_VIRTUAL_RTYPES
:
if
rschema
.
final
or
rschema
in
PURE_VIRTUAL_RTYPES
:
continue
if
rschema
.
inlined
:
for
subjtype
in
rschema
.
subjects
():
...
...
server/hooks.py
View file @
deb13e88
...
...
@@ -244,7 +244,7 @@ def uniquecstrcheck_before_modification(session, entity):
for
attr
,
val
in
entity
.
items
():
if
val
is
None
:
continue
if
eschema
.
subj
ect_relation
(
attr
).
is_
final
()
and
\
if
eschema
.
subj
rels
[
attr
].
final
and
\
eschema
.
has_unique_values
(
attr
):
rql
=
'%s X WHERE X %s %%(val)s'
%
(
entity
.
e_schema
,
attr
)
rset
=
session
.
unsafe_execute
(
rql
,
{
'val'
:
val
})
...
...
@@ -257,7 +257,7 @@ def cstrcheck_after_update_attributes(session, entity):
return
schema
=
session
.
vreg
.
schema
for
attr
in
entity
.
edited_attributes
:
if
schema
.
rschema
(
attr
).
is_
final
()
:
if
schema
.
rschema
(
attr
).
final
:
constraints
=
[
c
for
c
in
entity
.
e_schema
.
constraints
(
attr
)
if
isinstance
(
c
,
RQLVocabularyConstraint
)]
if
constraints
:
...
...
server/hooksmanager.py
View file @
deb13e88
...
...
@@ -286,7 +286,7 @@ class PropagateSubjectRelationHook(Hook):
def
call
(
self
,
session
,
fromeid
,
rtype
,
toeid
):
for
eid
in
(
fromeid
,
toeid
):
etype
=
session
.
describe
(
eid
)[
0
]
if
not
self
.
schema
.
eschema
(
etype
).
has_subject_relation
(
self
.
rtype
)
:
if
self
.
rtype
not
in
self
.
schema
.
eschema
(
etype
).
subjrels
:
return
if
rtype
in
self
.
subject_relations
:
meid
,
seid
=
fromeid
,
toeid
...
...
@@ -312,12 +312,12 @@ class PropagateSubjectRelationAddHook(Hook):
eschema
=
self
.
schema
.
eschema
(
session
.
describe
(
fromeid
)[
0
])
execute
=
session
.
unsafe_execute
for
rel
in
self
.
subject_relations
:
if
eschema
.
has_subject_relation
(
rel
)
:
if
rel
in
eschema
.
subjrels
:
execute
(
'SET R %s P WHERE X eid %%(x)s, P eid %%(p)s, '
'X %s R, NOT R %s P'
%
(
rtype
,
rel
,
rtype
),
{
'x'
:
fromeid
,
'p'
:
toeid
},
'x'
)
for
rel
in
self
.
object_relations
:
if
eschema
.
has_object_relation
(
rel
)
:
if
rel
in
eschema
.
objrels
:
execute
(
'SET R %s P WHERE X eid %%(x)s, P eid %%(p)s, '
'R %s X, NOT R %s P'
%
(
rtype
,
rel
,
rtype
),
{
'x'
:
fromeid
,
'p'
:
toeid
},
'x'
)
...
...
@@ -336,12 +336,12 @@ class PropagateSubjectRelationDelHook(Hook):
eschema
=
self
.
schema
.
eschema
(
session
.
describe
(
fromeid
)[
0
])
execute
=
session
.
unsafe_execute
for
rel
in
self
.
subject_relations
:
if
eschema
.
has_subject_relation
(
rel
)
:
if
rel
in
eschema
.
subjrels
:
execute
(
'DELETE R %s P WHERE X eid %%(x)s, P eid %%(p)s, '
'X %s R'
%
(
rtype
,
rel
),
{
'x'
:
fromeid
,
'p'
:
toeid
},
'x'
)
for
rel
in
self
.
object_relations
:
if
eschema
.
has_object_relation
(
rel
)
:
if
rel
in
eschema
.
objrels
:
execute
(
'DELETE R %s P WHERE X eid %%(x)s, P eid %%(p)s, '
'R %s X'
%
(
rtype
,
rel
),
{
'x'
:
fromeid
,
'p'
:
toeid
},
'x'
)
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
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