def http_url(self):
        if self.context.deleted:
            return None

        url = canonical_url(self.parent.archive, request=self.request)
        return urlappend(
            url, '/'.join([
                '+sourcefiles', self.parent.source_package_name,
                self.parent.source_package_version,
                url_path_quote(self.context.filename.encode('utf-8'))
            ]))
Esempio n. 2
0
    def http_url(self):
        """Return the webapp URL for the context `LibraryFileAlias`.

        Preserve the `LibraryFileAlias.http_url` behaviour for deleted
        files, returning None.

        Mask webservice requests if it's the case, so the returned URL will
        be always relative to the parent webapp URL.
        """
        if self.context.deleted:
            return None

        parent_url = canonical_url(self.parent, request=self.request)
        traversal_url = urlappend(parent_url, '+files')
        url = urlappend(traversal_url,
                        url_path_quote(self.context.filename.encode('utf-8')))
        return url
Esempio n. 3
0
    def http_url(self):
        """Return the webapp URL for the context `LibraryFileAlias`.

        Preserve the `LibraryFileAlias.http_url` behavior for deleted
        files, returning None.

        Mask webservice requests if it's the case, so the returned URL will
        be always relative to the parent webapp URL.
        """
        if self.context.deleted:
            return None

        request = get_current_browser_request()
        if WebServiceLayer.providedBy(request):
            request = IWebBrowserOriginatingRequest(request)

        parent_url = canonical_url(self.parent, request=request)
        traversal_url = urlappend(parent_url, '+files')
        url = urlappend(
            traversal_url,
            url_path_quote(self.context.filename.encode('utf-8')))
        return url
Esempio n. 4
0
 def _matchingAliases(self, digest):
     library = self.storage.library
     matches = ['%s/%s' % (aID, url_path_quote(aName))
                for fID in library.lookupBySHA1(digest)
                for aID, aName, aType in library.getAliases(fID)]
     return matches
Esempio n. 5
0
 def _matchingAliases(self, digest):
     library = self.storage.library
     matches = ['%s/%s' % (aID, url_path_quote(aName))
                for fID in library.lookupBySHA1(digest)
                for aID, aName, aType in library.getAliases(fID)]
     return matches