Commits

zuroc committed 759687b Draft Merge

fix

  • Participants
  • Parent commits fb8c304, c519bf9

Comments (0)

Files changed (3)

model/buzz_po_reply.py

         po_id = i.id
         result.append((
             po_id,                                  #0
-            cnenoverflow(i.name,28)[0],             #1
+            cnenoverflow(i.name,25)[0],             #1
             
             i.reply_count,                          #2
             i.cid,                                  #3

model/vps_sell.py

 
 if __name__ == '__main__':
     pass
+    from model.zsite import Zsite
+    from model.user_mail import mail_by_user_id
+    for i in VpsOne.where(state=VPS_STATE_RUN):
+        print i.user_id
+        print mail_by_user_id(i.user_id) 
+        zsite = Zsite.mc_get(i.user_id)
+        print "http:%s"%zsite.link
+        print "数据中心", i.data_center
+        print "内存", i.ram
+        print zsite.name
+        print "-"*10
 
 #from yun.vps.server.model.vps import vps_saas_cmd_open
 #vps_saas_cmd_open(3 , 116)
     """
     if domain is None:
         domain = '.%s'%tld_name(self.request.host)
-    name = utf8(name)
-    value = utf8(value)
+
+
+    name = escape.native_str(name)
+    value = escape.native_str(value)
     if re.search(r"[\x00-\x20]", name + value):
         # Don't let us accidentally inject bad stuff
-        raise ValueError('Invalid cookie %r: %r' % (name, value))
-    if not hasattr(self, '_new_cookies'):
-        self._new_cookies = []
-    new_cookie = Cookie.BaseCookie()
-    self._new_cookies.append(new_cookie)
-    new_cookie[name] = value
+        raise ValueError("Invalid cookie %r: %r" % (name, value))
+    if not hasattr(self, "_new_cookie"):
+        self._new_cookie = Cookie.SimpleCookie()
+    if name in self._new_cookie:
+        del self._new_cookie[name]
+    self._new_cookie[name] = value
+    morsel = self._new_cookie[name]
     if domain:
-        new_cookie[name]['domain'] = domain
+        morsel["domain"] = domain
+
+
 
     if expires_days is not None and not expires:
         expires = datetime.datetime.utcnow() + datetime.timedelta(
             expires = email.utils.formatdate(
                 timestamp, localtime=False, usegmt=True
             )
-        new_cookie[name]['expires'] = expires
     else:
-        new_cookie[name]['expires'] = 'Tue, 01 Jan 2030 00:00:00 GMT'
+        expires  = 'Tue, 01 Jan 2030 00:00:00 GMT'
+    morsel['expires'] = expires
 
     if path:
-        new_cookie[name]['path'] = path
+        morsel["path"] = path
     for k, v in kwargs.iteritems():
-        new_cookie[name][k] = v
+        if k == 'max_age':
+            k = 'max-age'
+        morsel[k] = v
+
+
+    #name = utf8(name)
+    #value = utf8(value)
+    #if re.search(r"[\x00-\x20]", name + value):
+    #    # Don't let us accidentally inject bad stuff
+    #    raise ValueError('Invalid cookie %r: %r' % (name, value))
+    #if not hasattr(self, '_new_cookie'):
+    #    self._new_cookie = []
+    #new_cookie = Cookie.BaseCookie()
+    #self._new_cookie.append(new_cookie)
+    #new_cookie[name] = value
+    #if domain:
+    #    new_cookie[name]['domain'] = domain
+
+    #if expires_days is not None and not expires:
+    #    expires = datetime.datetime.utcnow() + datetime.timedelta(
+    #        days=expires_days)
+    #if expires:
+    #    if type(expires) is not str:
+    #        timestamp = calendar.timegm(expires.utctimetuple())
+    #        expires = email.utils.formatdate(
+    #            timestamp, localtime=False, usegmt=True
+    #        )
+    #    new_cookie[name]['expires'] = expires
+    #else:
+    #    new_cookie[name]['expires'] = 'Tue, 01 Jan 2030 00:00:00 GMT'
+
+    #if path:
+    #    new_cookie[name]['path'] = path
+    #for k, v in kwargs.iteritems():
+    #    new_cookie[name][k] = v
 
 web.RequestHandler.set_cookie = set_cookie