--- a/devtools/testlib.py Fri Feb 22 19:36:40 2013 +0100
+++ b/devtools/testlib.py Tue Mar 12 12:08:22 2013 +0100
@@ -664,11 +664,11 @@
def app_publish(self, *args, **kwargs):
return self.app_handle_request(*args, **kwargs)
- def ctrl_publish(self, req, ctrl='edit'):
+ def ctrl_publish(self, req, ctrl='edit', rset=None):
"""call the publish method of the edit controller"""
ctrl = self.vreg['controllers'].select(ctrl, req, appli=self.app)
try:
- result = ctrl.publish()
+ result = ctrl.publish(rset)
req.cnx.commit()
except web.Redirect:
req.cnx.commit()
@@ -680,7 +680,7 @@
req.form will be setup using the url's query string
"""
- req = self.request()
+ req = self.request(url=url)
if isinstance(url, unicode):
url = url.encode(req.encoding) # req.setup_params() expects encoded strings
querystring = urlparse.urlparse(url)[-2]
@@ -688,16 +688,35 @@
req.setup_params(params)
return req
- def url_publish(self, url):
- """takes `url`, uses application's app_resolver to find the
- appropriate controller, and publishes the result.
+ def url_publish(self, url, data=None):
+ """takes `url`, uses application's app_resolver to find the appropriate
+ controller and result set, then publishes the result.
+
+ To simulate post of www-form-encoded data, give a `data` dictionary
+ containing desired key/value associations.
This should pretty much correspond to what occurs in a real CW server
except the apache-rewriter component is not called.
"""
req = self.req_from_url(url)
+ if data is not None:
+ req.form.update(data)
ctrlid, rset = self.app.url_resolver.process(req, req.relative_path(False))
- return self.ctrl_publish(req, ctrlid)
+ return self.ctrl_publish(req, ctrlid, rset)
+
+ def http_publish(self, url, data=None):
+ """like `url_publish`, except this returns a http response, even in case of errors"""
+ req = self.req_from_url(url)
+ if data is not None:
+ req.form.update(data)
+ # remove the monkey patched error handler
+ fake_error_handler = self.app.error_handler
+ del self.app.error_handler
+ try:
+ result = self.app_handle_request(req, req.relative_path(False))
+ finally:
+ self.app.error_handler = fake_error_handler
+ return result, req
@staticmethod
def _parse_location(req, location):
--- a/doc/book/en/devrepo/devcore/dbapi.rst Fri Feb 22 19:36:40 2013 +0100
+++ b/doc/book/en/devrepo/devcore/dbapi.rst Tue Mar 12 12:08:22 2013 +0100
@@ -111,15 +111,18 @@
:members:
-The `Cursor` API
-~~~~~~~~~~~~~~~~
+The `Cursor` and `Connection` API
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The whole cursor API is developped below.
.. note::
- In practice we use the `.execute` method on the _cw object of
+ In practice you'll usually use the `.execute` method on the _cw object of
appobjects. Usage of other methods is quite rare.
.. autoclass:: cubicweb.dbapi.Cursor
:members:
+
+.. autoclass:: cubicweb.dbapi.Connection
+ :members:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/migration/3.15.9_Any.py Tue Mar 12 12:08:22 2013 +0100
@@ -0,0 +1,2 @@
+sync_schema_props_perms(('State', 'state_of', 'Workflow'), commit=False)
+sync_schema_props_perms(('State', 'name', 'String'))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/migration/3.16.1_Any.py Tue Mar 12 12:08:22 2013 +0100
@@ -0,0 +1,2 @@
+sync_schema_props_perms(('State', 'state_of', 'Workflow'), commit=False)
+sync_schema_props_perms(('State', 'name', 'String'))
--- a/schemas/workflow.py Fri Feb 22 19:36:40 2013 +0100
+++ b/schemas/workflow.py Tue Mar 12 12:08:22 2013 +0100
@@ -79,7 +79,7 @@
state_of = SubjectRelation('Workflow', cardinality='1*', composite='object',
description=_('workflow to which this state belongs'),
constraints=[RQLUniqueConstraint('S name N, Y state_of O, Y name N', 'Y',
- _('workflow already have a state of that name'))])
+ _('workflow already has a state of that name'))])
class BaseTransition(EntityType):