import schevo.error from schevo import field from schevo.fieldspec import FieldMap, FieldSpecMap from schevo.label import label, plural from schevo.lib.odict import odict from schevo.meta import schema_metaclass import schevo.namespace from schevo.namespace import namespaceproperty from schevo import queryns from schevo.trace import log # -------------------------------------------------------------------- QueryMeta = schema_metaclass('Q') # -------------------------------------------------------------------- class Query(base.Query): """Simplest query possible, returning no results.""" __metaclass__ = QueryMeta def __call__(self): """Shortcut to get to `_query_results` method.""" return self._results() def _results(self):
TransactionExecuteRedefinitionRestricted, TransactionExpired, TransactionFieldsNotChanged, TransactionNotExecuted, ) from schevo.field import Entity, _EntityBase, not_fget from schevo.fieldspec import FieldMap, FieldSpecMap from schevo.label import label from schevo.meta import schema_metaclass import schevo.namespace from schevo.namespace import namespaceproperty from schevo.trace import log from schevo import transactionns T_metaclass = schema_metaclass('T') class TransactionMeta(T_metaclass): def __init__(cls, class_name, bases, class_dict): T_metaclass.__init__(cls, class_name, bases, class_dict) if (cls._restrict_subclasses and '_restrict_subclasses' not in class_dict ): # Base class is restricting its subclasses. if '__init__' in class_dict or '_execute' in class_dict: raise TransactionExecuteRedefinitionRestricted( class_name, bases) cls._h_names = cls.get_method_names('h_') cls._x_names = cls.get_method_names('x_') def get_method_names(cls, prefix):