def to_appspot_url(self): if self.is_folder: name = re.sub(re.escape('_\$folder\$\Z'), '/', self.key) else: name = self.key return u'http://%s/%s/%s' % (current_gae_url(), url_escape(self.bucket), url_escape(name))
def to_url(self, secure=False): scheme = 'http'; if secure: scheme = 'https' if self.bucket.islower(): return u'%s://%s.%s/%s' % (scheme, url_escape(self.bucket), self.DefaultLocation, url_escape(self.key)) else: return u'%s://%s/%s/%s' % (scheme, self.DefaultLocation, url_escape(self.bucket), url_escape(self.key))
def maybe_escape(s): return url_escape(s, plus=False) if urlescape else s