示例#1
0
文件: app.py 项目: khoama/pilbox
 def _validate_url(self):
     url = self.get_argument("url")
     if not url:
         raise errors.UrlError("Missing url")
     elif url.startswith("http://") or url.startswith("https://"):
         return
     elif self.settings.get("implicit_base_url") and url.startswith("/"):
         return
     raise errors.UrlError("Unsupported protocol")
示例#2
0
 def _validate_url(self):
     if not self.get_argument("url"):
         raise errors.UrlError("Missing url")
     elif not self.get_argument("url").startswith("http://") \
             and not self.get_argument("url").startswith("https://"):
         raise errors.UrlError("Unsupported protocol")