Skip to content
Snippets Groups Projects

Topic/default/rql schema holder

Closed Guillaume Vandevelde requested to merge topic/default/rql_schema_holder into branch/default
8 unresolved threads
1 file
+ 28
1
Compare changes
  • Side-by-side
  • Inline
@@ -33,6 +33,7 @@ from cubicweb.web import RemoteCallFailed, DirectResponse
from cubicweb.web.controller import Controller
from cubicweb.web.views.urlrewrite import rgx_action, SchemaBasedRewriter
from cubicweb import Binary
from cubicweb_rqlcontroller.rql_schema_holder import RqlIOSchemaHolder
ARGRE = re.compile(r'__r(?P<ref>\d+)$')
@@ -74,6 +75,28 @@ class match_request_content_type(ExpectedValuePredicate):
return header
class RqlIOSchemaController(Controller, RqlIOSchemaHolder):
__regid__ = 'rqlio_schema'
__select__ = match_http_method('GET')
def publish(self, rset=None):
self._cw.set_content_type('application/json')
return json.dumps(
self.get_schema
).encode(self._cw.encoding)
class RqlIOHashController(Controller, RqlIOSchemaHolder):
__regid__ = 'rqlio_schema_hash'
__select__ = match_http_method('GET')
def publish(self, rset=None):
self._cw.set_content_type('application/json')
return json.dumps(
self.get_schema_hash
).encode(self._cw.encoding)
class RqlIOController(Controller):
"""posted rql queries and arguments use the following pattern:
@@ -167,6 +190,10 @@ class RqlIOController(Controller):
class RQLIORewriter(SchemaBasedRewriter):
rules = [
(re.compile('/rqlio/schema'),
rgx_action(controller='rqlio_schema')),
(re.compile('/rqlio/hash'),
    • I would like an information about "schema" in this route. Something like

      Suggested change
      195 (re.compile('/rqlio/hash'),
      195 (re.compile('/rqlio/schema/hash'),

      Because for now we do not know from what this hash come.

Please register or sign in to reply
rgx_action(controller='rqlio_schema_hash')),
(re.compile('/rqlio/(?P<version>.+)$'),
rgx_action(controller='rqlio', formgroups=('version',))),
rgx_action(controller='rqlio', formgroups=('version',)))
]
Loading