def get(self): recent_agencies = utils.get_recent_agencies() recent_messages = utils.get_recent_messages() agency_count = utils.get_agency_count() self.render('index.html', recent_messages=recent_messages, recent_agencies=recent_agencies, agency_count=agency_count)
def get(self): recent_agencies = utils.get_recent_agencies() recent_messages = utils.get_recent_messages()[:7] agency_count = utils.get_agency_count() self.render('index.html', recent_messages=recent_messages, recent_agencies=recent_agencies, agency_count=agency_count)
def get(self, user_or_agency=None, slug=None): self.set_header('Content-Type', 'application/atom+xml') base_url = self.request.protocol + "://" + self.request.host if not user_or_agency: messages = utils.get_recent_messages() self.render('atom.xml', user_or_agency=user_or_agency, messages=messages, base_url=base_url) elif user_or_agency == 'user': user = urllib.unquote(slug) if '@' in user: user = users.User(user) else: user = users.User(user+'@gmail.com') messages = model.Message.all().filter('date >', datetime.datetime.now()-datetime.timedelta(90)).filter('user ='******'-date').fetch(15) self.render('agency_atom.xml', user_or_agency=user_or_agency, messages=messages, base_url=base_url, user=str(user), agency=None) elif user_or_agency == 'agency': alias = utils.lookup_agency_alias(slug) if alias: return self.redirect('/%s/%s/feed' % (user_or_agency, alias)) agency = utils.get_agency(slug) messages = [x.message for x in model.MessageAgency.all().filter('agency =', agency).filter('date >', datetime.datetime.now()-datetime.timedelta(90)).order('-date').fetch(15)] self.render('agency_atom.xml', agency=agency, user_or_agency=user_or_agency, messages=messages, base_url=base_url, user='')