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
def _prepare_glob_dict(): email_list = EmailModel().all() email_list.order("-date") product_list = ProductModel().all() product_list.order("-date") images_list = ImageModel().all() images_list.order("-date") propertie_list = PropertieModel().all() propertie_list.order("-date") comment_list = CommentModel().all() comment_list.filter("category", COMMENT_CATEGORY_PAGE) comment_list.order("-date") twitter_list = CommentModel().all() twitter_list.filter("category", COMMENT_CATEGORY_TWITTER) twitter_list.order("-date") glob_dict = { 'langs':CMS_LANGUAGES, 'page_list':get_pages(), 'blog_list':get_blog_pages(), 'menu_list':get_menus(), 'email_list':email_list, 'product_list':product_list, 'comment_list':comment_list, 'twitter_list':twitter_list, 'image_list':images_list, 'propertie_list':propertie_list, "admin_menu" : admin_menu } return glob_dict