Commit 6d92b048 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

R [base classes] only AppObject remaning, no more AppRsetObject

parent 48cd71bdb5cd
......@@ -31,7 +31,7 @@ class Cache(dict):
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 @@ class AppRsetObject(VObject):
@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 @@ class AppRsetObject(VObject):
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 @@ class AppRsetObject(VObject):
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 @@ class AppRsetObject(VObject):
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)
......@@ -20,7 +20,7 @@ from rql.utils import rqlvar_maker
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 @@ class _metaentity(type):
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 @@ class Entity(AppRsetObject, dict):
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:
......
......@@ -242,7 +242,7 @@ class CWCache(EntityType):
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'),
......
......@@ -18,7 +18,7 @@ from rql import nodes
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 @@ STRICT_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN
# 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 @@ class View(AppRsetObject):
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
......
......@@ -114,7 +114,7 @@ class VObject(object):
@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
......
......@@ -11,12 +11,12 @@ from cubicweb import target
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.
"""
......
......@@ -24,7 +24,7 @@ from cubicweb import Unauthorized, typed_eid
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 @@ def _cleanup_rqlst(rqlst, mainvar):
## base facet classes #########################################################
class AbstractFacet(AppRsetObject):
class AbstractFacet(AppObject):
__abstract__ = True
__registry__ = 'facets'
property_defs = {
......@@ -265,7 +265,7 @@ class AbstractFacet(AppRsetObject):
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:
......
......@@ -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 @@ class FieldNotFound(Exception):
found
"""
class Form(FormMixIn, AppRsetObject):
class Form(FormMixIn, AppObject):
__metaclass__ = metafieldsform
__registry__ = 'forms'
......@@ -13,7 +13,7 @@ from logilab.mtconverter import xml_escape
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.widgets import checkbox
from cubicweb.web.formfields import HiddenInitialValueField
class FormRenderer(AppRsetObject):
class FormRenderer(AppObject):
"""basic renderer displaying fields in a two columns table label | value
+--------------+--------------+
......
......@@ -54,8 +54,6 @@ class URLRewriter(AppObject):
__metaclass__ = metarewriter
__registry__ = 'urlrewriting'
__abstract__ = True
id = 'urlrewriting'
priority = 1
def rewrite(self, req, uri):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment