Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RQL
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
RQL
Commits
ba03d9f51737
Commit
ba03d9f51737
authored
14 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
rql stcheck now check for backend availability of function
parent
7b111884fdde
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
__init__.py
+8
-2
8 additions, 2 deletions
__init__.py
base.py
+1
-1
1 addition, 1 deletion
base.py
editextensions.py
+1
-2
1 addition, 2 deletions
editextensions.py
stcheck.py
+7
-1
7 additions, 1 deletion
stcheck.py
utils.py
+9
-2
9 additions, 2 deletions
utils.py
with
30 additions
and
8 deletions
ChangeLog
+
4
−
0
View file @
ba03d9f5
ChangeLog for RQL
=================
--
* enhanced Select.replace method
* rql st checker now checks function avaibility according to backend (if specified)
2010-06-11 -- 0.26.2
* totally remove 'IS' operator
...
...
This diff is collapsed.
Click to expand it.
__init__.py
+
8
−
2
View file @
ba03d9f5
...
...
@@ -38,7 +38,7 @@
- comparison of two queries
"""
def
__init__
(
self
,
schema
,
uid_func_mapping
=
None
,
special_relations
=
None
,
resolver_class
=
None
):
resolver_class
=
None
,
backend
=
None
):
# chech schema
#for e_type in REQUIRED_TYPES:
# if not schema.has_entity(e_type):
...
...
@@ -49,7 +49,7 @@
if
uid_func_mapping
:
for
key
in
uid_func_mapping
:
special_relations
[
key
]
=
'
uid
'
self
.
_checker
=
RQLSTChecker
(
schema
,
special_relations
)
self
.
_checker
=
RQLSTChecker
(
schema
,
special_relations
,
backend
)
self
.
_annotator
=
RQLSTAnnotator
(
schema
,
special_relations
)
self
.
_analyser_lock
=
threading
.
Lock
()
if
resolver_class
is
None
:
...
...
@@ -76,6 +76,12 @@
self
.
_annotator
.
schema
=
schema
self
.
_analyser
.
set_schema
(
schema
)
def
get_backend
(
self
):
return
self
.
_checker
.
backend
def
set_backend
(
self
,
backend
):
self
.
_checker
.
backend
=
backend
backend
=
property
(
get_backend
,
set_backend
)
def
parse
(
self
,
rqlstring
,
annotate
=
True
):
"""
Return a syntax tree created from a RQL string.
"""
rqlst
=
parse
(
rqlstring
,
False
)
...
...
This diff is collapsed.
Click to expand it.
base.py
+
1
−
1
View file @
ba03d9f5
...
...
@@ -18,4 +18,5 @@
"""
Base classes for RQL syntax tree nodes.
Note: this module uses __slots__ to limit memory usage.
"""
...
...
@@ -21,5 +22,4 @@
"""
__docformat__
=
"
restructuredtext en
"
class
BaseNode
(
object
):
...
...
This diff is collapsed.
Click to expand it.
editextensions.py
+
1
−
2
View file @
ba03d9f5
...
...
@@ -15,5 +15,5 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with rql. If not, see <http://www.gnu.org/licenses/>.
"""
RQL functions for manipulating syntax trees.
"""
RQL functions for manipulating syntax trees.
"""
...
...
@@ -19,5 +19,4 @@
"""
__docformat__
=
"
restructuredtext en
"
from
rql.nodes
import
Constant
,
Variable
,
VariableRef
,
Relation
,
make_relation
...
...
This diff is collapsed.
Click to expand it.
stcheck.py
+
7
−
1
View file @
ba03d9f5
...
...
@@ -80,6 +80,6 @@
errors due to a bad rql input
"""
def
__init__
(
self
,
schema
,
special_relations
=
None
):
def
__init__
(
self
,
schema
,
special_relations
=
None
,
backend
=
None
):
self
.
schema
=
schema
self
.
special_relations
=
special_relations
or
{}
...
...
@@ -84,5 +84,6 @@
self
.
schema
=
schema
self
.
special_relations
=
special_relations
or
{}
self
.
backend
=
backend
def
check
(
self
,
node
):
state
=
STCheckState
()
...
...
@@ -417,6 +418,11 @@
funcdescr
.
check_nbargs
(
len
(
function
.
children
))
except
BadRQLQuery
,
ex
:
state
.
error
(
str
(
ex
))
if
self
.
backend
is
not
None
:
try
:
funcdescr
.
st_check_backend
(
self
.
backend
,
function
)
except
BadRQLQuery
,
ex
:
state
.
error
(
str
(
ex
))
if
funcdescr
.
aggregat
:
if
isinstance
(
function
.
children
[
0
],
Function
)
and
\
function
.
children
[
0
].
descr
().
aggregat
:
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
9
−
2
View file @
ba03d9f5
...
...
@@ -15,5 +15,5 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with rql. If not, see <http://www.gnu.org/licenses/>.
"""
Miscellaneous utilities for RQL.
"""
Miscellaneous utilities for RQL.
"""
...
...
@@ -19,4 +19,3 @@
"""
__docformat__
=
"
restructuredtext en
"
...
...
@@ -21,5 +20,7 @@
__docformat__
=
"
restructuredtext en
"
from
rql._exceptions
import
BadRQLQuery
UPPERCASE
=
u
'
ABCDEFGHIJKLMNOPQRSTUVWXYZ
'
def
decompose_b26
(
index
,
table
=
UPPERCASE
):
"""
Return a letter (base-26) decomposition of index.
"""
...
...
@@ -78,6 +79,12 @@
'
,
'
.
join
(
sorted
(
child
.
get_description
(
mainindex
,
tr
)
for
child
in
iter_funcnode_variables
(
funcnode
))))
@monkeypatch
(
FunctionDescr
)
def
st_check_backend
(
self
,
backend
,
funcnode
):
if
not
self
.
supports
(
backend
):
raise
BadRQLQuery
(
"
backend %s doesn
'
t support function %s
"
%
(
backend
,
self
.
name
))
def
iter_funcnode_variables
(
funcnode
):
for
term
in
funcnode
.
children
:
try
:
...
...
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