Commits

fan yu committed ab69e44

Fixed url parse bug when backend is not upyun.

  • Participants
  • Parent commits 30045b9

Comments (0)

Files changed (3)

 syntax: glob
+*.py~*
 *.pyc
 *.swp
+*.orig
 class SecondHandler(MainHandler):
     @tornado.web.asynchronous
     def get(self, fn, rect, size):
+        size = 0 if not size else size
         bucket = ''
         self.size = int(size)
         self.rect = rect
         if ret:
             bucket = ret.group(1)
             fn = ret.group(2)
+            print bucket
+            print fn
 
         self.add_callback(bucket, fn)
             
 application = tornado.web.Application([
     # bucket/filename
-    (r"/([^/]+/?[^/]+)$", MainHandler),
+    (r"/([^/]+/?[^/]+)", MainHandler),
     # bucket/filename/rect/size
-    (r"/([^/]+/?[^/]+)/([\d,]+)/(\d+)$", SecondHandler),
+    (r"/([^/,]+/?[^/,]+)/([\d,]+)/?(\d+)?", SecondHandler),
     ])
 
 if __name__ == "__main__":
 
 # coding:utf-8
 
+# 直接转存支持
+
 PORT = 40001
 BASE_URL = 'http://v0.api.upyun.com'