示例#1
0
 def get(self):
     lastNum = 0
     suppression = False
     contenu = ""
     upload = []
     if self.request.get('deleteContent'):
         d = db.GqlQuery("SELECT * FROM BlogUpload WHERE num=:1",int(self.request.get('num'))).fetch(100)
         db.delete(d)
         suppression=True
     if self.request.get('startTask'):
         taskqueue.add(url='/admin/import',params={'lastImport': self.request.get('num')})
     if self.request.get('displayContent'):
         for d in db.GqlQuery("SELECT * FROM BlogUpload WHERE num=:1",int(self.request.get('num'))).fetch(100):
             contenu+=d.content
     else:
         for i in db.GqlQuery("SELECT * FROM BlogUpload").fetch(100):
             if lastNum != i.num:
                 lastNum=i.num
                 upload.append(i)
     path = wpfe.TEMPLATE+"/admin/import.html"
     self.response.out.write(template.render(path,
         {
             'ParentTmpl': wpfe.TEMPLATE+"/admin/admin.html",
             'xmlContent': contenu,
             'suppress':suppression,
             'upload': upload
         })
     )       
示例#2
0
 def get(self, key_id):
     
     key_id = int(key_id)
     email = EmailModel().get_by_id(key_id)
     count = 0
     for to in re.split("[ ,;:\n\r]", email.send_to):
         if to and is_valid_email(to):
             count += 1
             try:
                 
                 
                 
                 
                 taskqueue.add(url='/mail_worker', params=dict(count=count, id=key_id, to=to))
             except Exception, e:
                 email.statistic = str(e)
                 email.status = "Erorr"
                 email.put()
                 self.redirect("admin/email?action=edit&email.key_id=%s" % key_id)
                 return None