def build(cls, manager): '''gather branch configuration''' cls._key(selfname(cls), manager) i = cls.include m = manager.set t = lambda x: not x[0].startswith('_') or isinstance(x[1], strings) exhaustmap(vars(cls), lambda x, y: m(i(y), x), t)
def register(self, model): """ add model class to appspace @param model: graph element model """ self.B.set(model, selfname(model), conf.userspace)
def build(cls, manager): '''gather namespace configuration''' label = selfname(cls) cls._key(label, manager) m = manager.set n = partial(manager.keyed, ANamespace) t = lambda k, v: v.build(manager) if n(v) else m(v, k, label) exhaustmap(vars(cls), t, cls._filter)
def build(cls): '''build manager configuration from class''' l = selfname(cls) # set key key = cls.key if isinstance(key, strings): # load key if string key = lazyimport(key) manager = cls._manager(l, key) # pylint: disable-msg=e1121 b = partial(manager.keyed, ABranch) n = partial(manager.keyed, ANamespace) m = manager.set t = lambda x, y: y.build(manager) if (n(y) or b(y)) else m(y, x, l) exhaustmap(vars(cls), t, cls._filter) return manager
def C(self): '''local settings''' existing = self.traits.localize() metas = dict() # model name metas['name'] = selfname(self) class_names = self.traits.names # slug field try: metas['slug_from'] = class_names(slug_from=True)[0] except IndexError: metas['slug_from'] = '' # properties to index metas['indexed'] = set(k for k in class_names(indexed=True)) # properties indexed for full text search metas['fts_indexed'] = set(k for k in class_names(full_text=True)) # properties to HTML escape metas['escaped'] = set(k for k in class_names(escaped=True)) existing.update(metas) return existing