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
370898981f65
Commit
370898981f65
authored
15 years ago
by
adrien di mascio
Browse files
Options
Downloads
Patches
Plain Diff
cleaner function handling based on the new logilab.db package
parent
4f10ff2c720c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/control
+1
-1
1 addition, 1 deletion
debian/control
utils.py
+10
-15
10 additions, 15 deletions
utils.py
with
11 additions
and
16 deletions
debian/control
+
1
−
1
View file @
37089898
...
...
@@ -12,7 +12,7 @@
Package: python-rql
Architecture: any
XB-Python-Version: ${python:Versions}
Depends: ${python:Depends}, ${misc:Depends}, ${shlibs:Depends}, python-logilab-common (>= 0.35.3-1), yapps2-runtime
Depends: ${python:Depends}, ${misc:Depends}, ${shlibs:Depends}, python-logilab-common (>= 0.35.3-1), yapps2-runtime
, python-logilab-db
Provides: ${python:Provides}
Description: relationship query language (RQL) utilities
A library providing the base utilities to handle RQL queries,
...
...
This diff is collapsed.
Click to expand it.
utils.py
+
10
−
15
View file @
37089898
...
...
@@ -52,6 +52,8 @@
'
LIMIT
'
,
'
OFFSET
'
))
from
logilab.common.adbh
import
_GenericAdvFuncHelper
,
FunctionDescr
,
\
auto_register_function
from
logilab.common.decorators
import
monkeypatch
from
logilab.db
import
SQL_FUNCTIONS_REGISTRY
,
FunctionDescr
RQL_FUNCTIONS_REGISTRY
=
SQL_FUNCTIONS_REGISTRY
.
copy
()
...
...
@@ -57,3 +59,4 @@
def
st_description
(
cls
,
funcnode
,
mainindex
,
tr
):
@monkeypatch
(
FunctionDescr
)
def
st_description
(
self
,
funcnode
,
mainindex
,
tr
):
return
'
%s(%s)
'
%
(
...
...
@@ -59,5 +62,5 @@
return
'
%s(%s)
'
%
(
tr
(
cls
.
name
),
tr
(
self
.
name
),
'
,
'
.
join
(
sorted
(
child
.
get_description
(
mainindex
,
tr
)
for
child
in
iter_funcnode_variables
(
funcnode
))))
...
...
@@ -61,8 +64,6 @@
'
,
'
.
join
(
sorted
(
child
.
get_description
(
mainindex
,
tr
)
for
child
in
iter_funcnode_variables
(
funcnode
))))
FunctionDescr
.
st_description
=
classmethod
(
st_description
)
def
iter_funcnode_variables
(
funcnode
):
for
term
in
funcnode
.
children
:
try
:
...
...
@@ -93,6 +94,4 @@
node2
=
node2
.
parent
raise
Exception
(
'
DUH!
'
)
FUNCTIONS
=
_GenericAdvFuncHelper
.
FUNCTIONS
.
copy
()
def
register_function
(
funcdef
):
...
...
@@ -98,10 +97,6 @@
def
register_function
(
funcdef
):
if
isinstance
(
funcdef
,
basestring
)
:
funcdef
=
FunctionDescr
(
funcdef
.
upper
())
assert
not
funcdef
.
name
in
FUNCTIONS
,
\
'
%s is already registered
'
%
funcdef
.
name
FUNCTIONS
[
funcdef
.
name
]
=
funcdef
auto_register_function
(
funcdef
)
RQL_FUNCTIONS_REGISTRY
.
register_function
(
funcdef
)
SQL_FUNCTIONS_REGISTRY
.
register_function
(
funcdef
)
def
function_description
(
funcname
):
"""
Return the description (`FunctionDescription`) for a RQL function.
"""
...
...
@@ -105,7 +100,7 @@
def
function_description
(
funcname
):
"""
Return the description (`FunctionDescription`) for a RQL function.
"""
return
FUNCTIONS
[
funcname
.
upper
()]
return
RQL_
FUNCTIONS
_REGISTRY
.
get_function
(
funcname
)
def
quote
(
value
):
"""
Quote a string value.
"""
...
...
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