--- a/appobject.py Mon Aug 03 10:53:31 2009 +0200
+++ b/appobject.py Mon Aug 03 14:14:07 2009 +0200
@@ -31,7 +31,7 @@
CACHE_REGISTRY = {}
-class AppRsetObject(VObject):
+class AppObject(VObject):
"""This is the base class for CubicWeb application objects
which are selected according to a request and result set.
@@ -56,7 +56,7 @@
@classmethod
def registered(cls, reg):
- super(AppRsetObject, cls).registered(reg)
+ super(AppObject, cls).registered(reg)
cls.vreg = reg.vreg
cls.schema = reg.schema
cls.config = reg.config
@@ -73,7 +73,6 @@
selection according to a request, a result set, and optional
row and col
"""
- assert len(args) <= 2
return cls(*args, **kwargs)
# Eproperties definition:
@@ -111,7 +110,7 @@
return selector
def __init__(self, req=None, rset=None, row=None, col=None, **extra):
- super(AppRsetObject, self).__init__()
+ super(AppObject, self).__init__()
self.req = req
self.rset = rset
self.row = row
@@ -341,23 +340,3 @@
first = rql.split(' ', 1)[0].lower()
if first in ('insert', 'set', 'delete'):
raise Unauthorized(self.req._('only select queries are authorized'))
-
-
-class AppObject(AppRsetObject):
- """base class for application objects which are not selected
- according to a result set, only by their identifier.
-
- Those objects may not have req, rset and cursor set.
- """
-
- @classmethod
- def selected(cls, *args, **kwargs):
- """by default web app objects are usually instantiated on
- selection
- """
- return cls(*args, **kwargs)
-
- def __init__(self, req=None, rset=None, **kwargs):
- self.req = req
- self.rset = rset
- self.__dict__.update(kwargs)
--- a/entity.py Mon Aug 03 10:53:31 2009 +0200
+++ b/entity.py Mon Aug 03 14:14:07 2009 +0200
@@ -20,7 +20,7 @@
from cubicweb import Unauthorized
from cubicweb.rset import ResultSet
from cubicweb.selectors import yes
-from cubicweb.appobject import AppRsetObject
+from cubicweb.appobject import AppObject
from cubicweb.schema import RQLVocabularyConstraint, RQLConstraint, bw_normalize_etype
from cubicweb.common.uilib import printable_value, soup2xhtml
@@ -132,7 +132,7 @@
return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
-class Entity(AppRsetObject, dict):
+class Entity(AppObject, dict):
"""an entity instance has e_schema automagically set on
the class and instances has access to their issuing cursor.
@@ -300,7 +300,7 @@
return mainattr, needcheck
def __init__(self, req, rset=None, row=None, col=0):
- AppRsetObject.__init__(self, req, rset, row, col)
+ AppObject.__init__(self, req, rset, row, col)
dict.__init__(self)
self._related_cache = {}
if rset is not None:
--- a/schemas/base.py Mon Aug 03 10:53:31 2009 +0200
+++ b/schemas/base.py Mon Aug 03 14:14:07 2009 +0200
@@ -242,7 +242,7 @@
The target application is responsible for updating timestamp
when necessary to invalidate the cache (typically in hooks).
- Also, checkout the AppRsetObject.get_cache() method.
+ Also, checkout the AppObject.get_cache() method.
"""
permissions = {
'read': ('managers', 'users', 'guests'),
--- a/view.py Mon Aug 03 10:53:31 2009 +0200
+++ b/view.py Mon Aug 03 14:14:07 2009 +0200
@@ -18,7 +18,7 @@
from cubicweb import NotAnEntity
from cubicweb.selectors import yes, non_final_entity, nonempty_rset, none_rset
from cubicweb.selectors import require_group_compat, accepts_compat
-from cubicweb.appobject import AppRsetObject
+from cubicweb.appobject import AppObject
from cubicweb.utils import UStringIO, HTMLStream
from cubicweb.schema import display_name
@@ -73,7 +73,7 @@
# base view object ############################################################
-class View(AppRsetObject):
+class View(AppObject):
"""abstract view class, used as base for every renderable object such
as views, templates, some components...web
@@ -93,7 +93,7 @@
time to a write function to use.
"""
__registry__ = 'views'
- registered = require_group_compat(AppRsetObject.registered)
+ registered = require_group_compat(AppObject.registered)
templatable = True
need_navigation = True
--- a/vregistry.py Mon Aug 03 10:53:31 2009 +0200
+++ b/vregistry.py Mon Aug 03 14:14:07 2009 +0200
@@ -114,7 +114,7 @@
@classmethod
def build___select__(cls):
for klass in cls.mro():
- if klass.__name__ == 'AppRsetObject':
+ if klass.__name__ == 'AppObject':
continue # the bw compat __selector__ is there
klassdict = klass.__dict__
if ('__select__' in klassdict and '__selectors__' in klassdict
--- a/web/action.py Mon Aug 03 10:53:31 2009 +0200
+++ b/web/action.py Mon Aug 03 14:14:07 2009 +0200
@@ -11,12 +11,12 @@
from cubicweb.selectors import (partial_relation_possible, match_search_state,
one_line_rset, partial_may_add_relation, yes,
accepts_compat, condition_compat, deprecate)
-from cubicweb.appobject import AppRsetObject
+from cubicweb.appobject import AppObject
_ = unicode
-class Action(AppRsetObject):
+class Action(AppObject):
"""abstract action. Handle the .search_states attribute to match
request search state.
"""
--- a/web/facet.py Mon Aug 03 10:53:31 2009 +0200
+++ b/web/facet.py Mon Aug 03 14:14:07 2009 +0200
@@ -24,7 +24,7 @@
from cubicweb.schema import display_name
from cubicweb.utils import datetime2ticks, make_uid, ustrftime
from cubicweb.selectors import match_context_prop, partial_relation_possible
-from cubicweb.appobject import AppRsetObject
+from cubicweb.appobject import AppObject
from cubicweb.web.htmlwidgets import HTMLWidget
## rqlst manipulation functions used by facets ################################
@@ -241,7 +241,7 @@
## base facet classes #########################################################
-class AbstractFacet(AppRsetObject):
+class AbstractFacet(AppObject):
__abstract__ = True
__registry__ = 'facets'
property_defs = {
@@ -265,7 +265,7 @@
assert rset is not None or rqlst is not None
assert filtered_variable
instance = super(AbstractFacet, cls).selected(req, rset)
- #instance = AppRsetObject.selected(req, rset)
+ #instance = AppObject.selected(req, rset)
#instance.__class__ = cls
# facet retreived using `object_by_id` from an ajax call
if rset is None:
--- a/web/form.py Mon Aug 03 10:53:31 2009 +0200
+++ b/web/form.py Mon Aug 03 14:14:07 2009 +0200
@@ -7,7 +7,7 @@
"""
__docformat__ = "restructuredtext en"
-from cubicweb.appobject import AppRsetObject
+from cubicweb.appobject import AppObject
from cubicweb.view import NOINDEX, NOFOLLOW
from cubicweb.common import tags
from cubicweb.web import stdmsgs, httpcache, formfields
@@ -202,6 +202,6 @@
found
"""
-class Form(FormMixIn, AppRsetObject):
+class Form(FormMixIn, AppObject):
__metaclass__ = metafieldsform
__registry__ = 'forms'
--- a/web/views/formrenderers.py Mon Aug 03 10:53:31 2009 +0200
+++ b/web/views/formrenderers.py Mon Aug 03 14:14:07 2009 +0200
@@ -13,7 +13,7 @@
from simplejson import dumps
from cubicweb.common import tags
-from cubicweb.appobject import AppRsetObject
+from cubicweb.appobject import AppObject
from cubicweb.selectors import entity_implements, yes
from cubicweb.web import eid_param
from cubicweb.web import formwidgets as fwdgs
@@ -21,7 +21,7 @@
from cubicweb.web.formfields import HiddenInitialValueField
-class FormRenderer(AppRsetObject):
+class FormRenderer(AppObject):
"""basic renderer displaying fields in a two columns table label | value
+--------------+--------------+
--- a/web/views/urlrewrite.py Mon Aug 03 10:53:31 2009 +0200
+++ b/web/views/urlrewrite.py Mon Aug 03 14:14:07 2009 +0200
@@ -54,8 +54,6 @@
__metaclass__ = metarewriter
__registry__ = 'urlrewriting'
__abstract__ = True
-
- id = 'urlrewriting'
priority = 1
def rewrite(self, req, uri):