Example #1
0
 def preRender(self):
     today = date.today()
     key = [str(today.year),addSym(today.month),addSym(today.day)+'a']
     skip = self.request.args.get('skip',[0])[0]
     try:
         self.skip = int(skip)
     except:
         pass
     stale = not bool(self.request.args.get('stale',[''])[0])
     if not stale:
         globals()['gWords'] = None
     tag = self.request.args.get('tag',[None])[0]
     d = None
     if tag is None:
         self.title+=u' компьютеры и комплектующие'
         d = couch.openView(designID, 'fetch',startkey=key,descending=True, limit=self.items_on_page,
                       include_docs=True, skip=self.skip, stale=stale)
     else:
         self.tag = unicode(tag, 'utf-8')
         self.title=u'Бывший в употреблении '+self.tag
         d = couch.openView(designID, 'words',
                            key=self.tag, reduce=False,
                            stale=not bool(stale),
                            include_docs=True,limit=self.items_on_page,skip=self.skip)
     if globals()['gWords'] is None:            
         d1 = couch.openView(designID, 'words',reduce=True, group=True, stale=stale)
         d1.addCallback(installgWords)
     else:
         d1= defer.Deferred()
         d1.addCallback(lambda some: globals()['gWords'])
         d1.callback(None)
     li = defer.DeferredList((d,d1))
     li.addCallback(self.renderAds)
     return li
Example #2
0
def filterForNew(links):
    d = couch.openView(designID, "external_ids", keys=links, stale=False)
    d.addCallback(filterLinks, links)
    return d
Example #3
0
def evolve():
    d = couch.openView(designID, "external_ids", stale=False)
    d.addCallback(fixDubbies)
    return d