def test_collection(self): """ Build the collection, then update it's index of ID's """ collection = bcc.baseCouchCollection(fm.flagORM) collection.update() """ The collection at the point only contains a list of ID's but thats enough to check the length to make sure everything is in there. """ assert len(self.flags) == len(collection.pail) collection.paginate(1, 10) assert len(collection.pagination) == 10 collection.fetch() assert len(collection.tub) == 10 collection.resetPagination() collection.fetch() for i in collection: try: if int(i.userID) == 0 or int(i.userID) in range(0, 100): i.delete() except: pass collection.update()
def GET(self): """ """ page = self.env["members"]["p"] \ if self.env["members"].has_key("p") else 1 view = adminViewTemplatesTmpl(searchList=[self.tmplSearchList]) view.scripts = ["handlebars_1.0.min", "jquery.json-2.4.min", "sidebarTabs.flagr", "bulkCheck.flagr", "adminModal.flagr", "editForm.flagr", "adminViewTemplates.flagr", "dynamicInput.flagr"] templates = bcc.baseCouchCollection(tm.templateORM) templates.paginate(page, 25) templates.fetch() templates.format() view.templates = templates try: view.templateTypes = json.dumps(list(sm.getSetting("templates", "types"))) except: view.templateTypes = json.dumps([]) return view
def update(self): """ Updates the internal list of objects, stored in a couch list, deleting keys that no longer exist, and adding new keys that are not currently part of the collection. """ userIDs = bcc.baseCouchCollection(um.userORM) for user in userIDs.pail: userPail = pubfc.userPublicFlagsCollection(user) self.pail.extend(userPail.pail)
def GET(self): """ """ if self.env["cfg"].enableRequests: page = self.env["members"]["p"] \ if self.env["members"].has_key("p") else 1 view = adminViewRequestsTmpl(searchList=[self.tmplSearchList]) view.scripts = ["handlebars_1.0.min", "jquery.json-2.4.min", "sidebarTabs.flagr", "adminModal.flagr", "bulkCheck.flagr", "editForm.flagr", "adminViewRequests.flagr"] requests = bcc.baseCouchCollection(rm.requestORM) requests.paginate(page, 25) requests.fetch() requests.format() view.requests = requests try: currentTmpl = sm.getSetting("enableRequests", "tmplid") except: currentTmpl = "" tmpl = bcc.baseCouchCollection(tm.templateORM) tmpl.fetch() tmpl.filterBy("type", "email") for tmp in tmpl: if tmp.id == currentTmpl: tmp.current = True view.tmpls = tmpl return view else: self._404()
def GET(self): """ """ page = self.env["members"]["p"] \ if self.env["members"].has_key("p") else 1 view = adminViewUsersTmpl(searchList=[self.tmplSearchList]) users = bcc.baseCouchCollection(userORM) users.paginate(page, 25) users.fetch() users.format() view.users = users return view
def GET(self): """ """ page = self.env["members"]["p"] \ if self.env["members"].has_key("p") else 1 view = adminViewFlagsTmpl(searchList=[self.tmplSearchList]) flags = bcc.baseCouchCollection(fm.flagORM) flags.paginate(page, 25) flags.fetch() flags.format() flags.join(userORM, "userID") view.flags = flags return view