示例#1
0
文件: admin.py 项目: honten/diary
    def post(self):
        cpedialog = util.getCPedialog()
        cpedialog.title = self.request.get("title")
        cpedialog.author = self.request.get("author")
        cpedialog.email = users.GetCurrentUser().email()
        cpedialog.root_url = self.request.get("root_url")
        cpedialog.logo_images_space = self.request.get("logo_images_space")
        if int(self.request.get("num_post_per_page")) != cpedialog.num_post_per_page:
            cpedialog.num_post_per_page = int(self.request.get("num_post_per_page"))
            util.flushBlogPagesCache()
        cpedialog.cache_time = int(self.request.get("cache_time"))
        if self.request.get("debug"):
            cpedialog.debug = True
        else:
            cpedialog.debug = False
        cpedialog.host_ip = self.request.remote_addr
        cpedialog.host_domain = self.request.get("SERVER_NAME")

        if self.request.get("recaptcha_enable"):
            cpedialog.recaptcha_enable = True
            cpedialog.recaptcha_public_key = self.request.get("recaptcha_public_key")
            cpedialog.recaptcha_private_key = self.request.get("recaptcha_private_key")
        else:
            cpedialog.recaptcha_enable = False

        if self.request.get("delicious_enable"):
            cpedialog.delicious_enable = True
            if self.request.get("delicious_username") != cpedialog.delicious_username:
                cpedialog.delicious_username = self.request.get("delicious_username")
                util.flushDeliciousTag()
        else:
            cpedialog.delicious_enable = False

        if self.request.get("google_ajax_feed_enable"):
            cpedialog.google_ajax_feed_enable = True
            cpedialog.google_ajax_feed_title = self.request.get("google_ajax_feed_title")
            cpedialog.google_ajax_feed_result_num = int(self.request.get("google_ajax_feed_result_num"))
        else:
            cpedialog.google_ajax_feed_enable = False
        cpedialog.put()
        util.flushCPedialog()
        return True
示例#2
0
  def post(self):
        cpedialog = util.getCPedialog()
        cpedialog.title = self.request.get("title")
        cpedialog.author = self.request.get("author")
        cpedialog.email = users.GetCurrentUser().email()
        cpedialog.root_url = self.request.get("root_url")
        cpedialog.description = self.request.get("description")
        cpedialog.logo_images_space = self.request.get("logo_images_space")
        if(int(self.request.get("num_post_per_page"))!=cpedialog.num_post_per_page):
            cpedialog.num_post_per_page = int(self.request.get("num_post_per_page"))
            util.flushBlogPagesCache()        
        cpedialog.cache_time = int(self.request.get("cache_time"))
        if self.request.get("debug"):
            cpedialog.debug = True
        else:
            cpedialog.debug = False
        cpedialog.host_ip = self.request.remote_addr
        cpedialog.host_domain = self.request.get("SERVER_NAME")
        cpedialog.time_zone_offset = float(self.request.get("time_zone_offset"))
        if self.request.get("recaptcha_enable"):
            cpedialog.recaptcha_enable = True
            cpedialog.recaptcha_public_key =  self.request.get("recaptcha_public_key")
            cpedialog.recaptcha_private_key =  self.request.get("recaptcha_private_key")
        else:
            cpedialog.recaptcha_enable = False
            
        if self.request.get("delicious_enable"):
            cpedialog.delicious_enable = True
            if(self.request.get("delicious_username")!=cpedialog.delicious_username):
                cpedialog.delicious_username =  self.request.get("delicious_username")
                util.flushDeliciousTag()
        else:
            cpedialog.delicious_enable = False

        if self.request.get("analytics_enable"):
            cpedialog.analytics_enable = True
            cpedialog.analytics_web_property_id =  self.request.get("analytics_web_property_id")
        else:
            cpedialog.analytics_enable = False

        if self.request.get("google_ajax_feed_enable"):
            cpedialog.google_ajax_feed_enable = True
            cpedialog.google_ajax_feed_title =  self.request.get("google_ajax_feed_title")
            cpedialog.google_ajax_feed_result_num = int(self.request.get("google_ajax_feed_result_num"))
        else:
            cpedialog.google_ajax_feed_enable = False

        if self.request.get("show_description"):
            cpedialog.description_next_logo = True
        else:
            cpedialog.description_next_logo = False

        custom_logo_url = self.request.get("custom_logo_url")
        custom_logo = self.request.get("custom_logo")
        if custom_logo_url:
            cpedialog.site_logo = custom_logo_url
        elif custom_logo:
            images = Images()
            images.image = db.Blob(custom_logo)
            images.uploader = users.GetCurrentUser()
            key = images.put()
            cpedialog.site_logo = "/rpc/img?img_id=%s" % (key)

        cpedialog.put()
        util.flushCPedialog()
        self.redirect('/admin')
        return