Exemplo n.º 1
0
    def url(self, name):
        if name.startswith(self.location):
            name = name[len(self.location) + 1:]

        name = os.path.basename(self.location) + "/" + name

        if self.base_url is None:
            raise ValueError("This file is not accessible via a URL.")

        myurl = urlparse.urljoin(self.base_url, filepath_to_uri(name))

        if "static" not in self.location:
            # Use a dynamic URL for "non-static" files.
            try:
                new_name = os.path.dirname(self.location) + "/" + name
                fp = filepath_to_uri(new_name)
                cache_key = 'django-dropbox-size:{}'.format(fp)
                myurl = cache.get(cache_key)
                if not myurl:
                    try:
                        shared_link = self.client.sharing_create_shared_link(fp)
                        myurl = shared_link.url + '&raw=1'
                        logger.debug("shared link: {0}, myurl: {1}".format(shared_link, myurl))
                    except Exception,e:
                        logger.exception(e)
                    if myurl is None:
                        temp_link = self.client.files_get_temporary_link(fp)
                        myurl = temp_link.link
                        logger.debug("temp link: {0}, myurl: {1}".format(temp_link, myurl))
                    cache.set(cache_key, myurl, SHARE_LINK_CACHE_TIMEOUT)
            except Exception,e:
                logger.exception(e)
Exemplo n.º 2
0
    def size(self, name):
        cache_key = 'django-dropbox-size:%s' % filepath_to_uri(name)
        size = cache.get(cache_key)

        if not size:
            size = self.client.metadata(filepath_to_uri(name))['bytes']
            cache.set(cache_key, size, CACHE_TIMEOUT)

        return size
Exemplo n.º 3
0
    def url(self, name):
        cache_key = 'django-dropbox-url:%s' % filepath_to_uri(name)
        url = cache.get(cache_key)

        if not url:
            url = self.client.share(filepath_to_uri(name), short_url=False)['url'] + '?dl=1'
            cache.set(cache_key, url, CACHE_TIMEOUT)

        return url
Exemplo n.º 4
0
    def url(self, name):
        cache_key = 'django-dropbox-url:%s' % filepath_to_uri(name)
        url = cache.get(cache_key)

        if not url:
            url = self.client.share(filepath_to_uri(name), short_url=False)['url']
            # this replace is for force to dropbox url to send the url like a content and don't
            # like a link to donwload
            url = url.replace("www", "photos-4")

            cache.set(cache_key, url, CACHE_TIMEOUT)

        return url
Exemplo n.º 5
0
def send_file(request, filepath, last_modified=None, filename=None):
    fullpath = filepath
    # Respect the If-Modified-Since header.
    statobj = os.stat(fullpath)
    if filename:
        mimetype, encoding = mimetypes.guess_type(filename)
    else:
        mimetype, encoding = mimetypes.guess_type(fullpath)

    mimetype = mimetype or 'application/octet-stream'

    if settings.USE_SENDFILE:
        response = django_sendfile_response(request, filepath)
    else:
        response = HttpResponse(open(fullpath, 'rb').read(), content_type=mimetype)

    if not last_modified:
        response["Last-Modified"] = http_date(statobj.st_mtime)
    else:
        if isinstance(last_modified, datetime):
            last_modified = float(dateformat.format(last_modified, 'U'))
        response["Last-Modified"] = http_date(epoch_seconds=last_modified)

    response["Content-Length"] = statobj.st_size

    if encoding:
        response["Content-Encoding"] = encoding

    if filename:
        filename_escaped = filepath_to_uri(filename)
        response["Content-Disposition"] = "attachment; filename=%s" % filename_escaped

    return response
Exemplo n.º 6
0
 def url(self, name):
     if self.base_url is None:
         raise ValueError("This file is not accessible via a URL.")
     url = filepath_to_uri(name)
     if url is not None:
         url = url.lstrip("/")
     return urljoin(self.base_url, url)
Exemplo n.º 7
0
 def _get_SIZE_url(self, size):
     photosize = PhotoSizeCache().sizes.get(size)
     if not self.size_exists(photosize):
         self.create_size(photosize)
     if photosize.increment_count:
         self.increment_count()
     return "/".join([self.cache_url(), filepath_to_uri(self._get_filename_for_size(photosize.name))])
Exemplo n.º 8
0
    def size(self, name):
        cache_key = 'django-dropbox-size:{}'.format(filepath_to_uri(name))
        size = cache.get(cache_key)

        if not size:
            size = self.client.files_get_metadata(name).size
            cache.set(cache_key, size, CACHE_TIMEOUT)
        return size
Exemplo n.º 9
0
 def url(self):
     url = self.file_signature % {
         'source': filepath_to_uri(self.source),
         'size': self.size_string,
         'method': self.method,
         'secret': self.secret,
         'extension': self.extension}
     return urlparse.urljoin(self.base_url, url)
Exemplo n.º 10
0
 def url(self, name):
     """
     Returns an absolute URL where the file's contents can be accessed
     directly by a Web browser.
     """
     if self.aws_s3_public_url:
         return urljoin(self.aws_s3_public_url, filepath_to_uri(name))
     return self._generate_url(name)
Exemplo n.º 11
0
    def url(self, name):
        name = self._normalize_name(self._clean_name(name))
        name = filepath_to_uri(name)

        expire = 3600 if not hasattr(settings, 'QINIU_PREVIEW_EXPIRE') else settings.QINIU_PREVIEW_EXPIRE

        protocol = 'https://' if self.secure_url else 'http://'
        url = urljoin(protocol + self.bucket_domain, name)
        return self.auth.private_download_url(url, expires=expire)
Exemplo n.º 12
0
 def url(self, name):
     name = self._normalize_name(self._clean_name(name))
     name = filepath_to_uri(name)
     protocol = u'https://' if self.secure_url else u'http://'
     url = urljoin(protocol + self.bucket_domain, name)
     if self.private_url:
         return self.auth.private_download_url(url, self.private_url_expires)
     else:
         return url
Exemplo n.º 13
0
    def _get_SIZE_url(self, size):
        photosize = [item for item in PHOTOREPORT_SIZES if item['name'] == size][0]

        if not self.size_exists(photosize):
            self.create_size(photosize)

        if photosize['increment_count']:
            self.increment_count()

        return '/'.join([self.cache_url(), filepath_to_uri(self._get_filename_for_size(photosize['name']))])
Exemplo n.º 14
0
 def url(self, name, headers=None, response_headers=None):
     name = self._normalize_name(self._clean_name(name))
     if self.custom_domain:
         return "%s//%s/%s" % (self.url_protocol,
                               self.custom_domain, filepath_to_uri(name))
     return self.connection.generate_url(self.querystring_expire,
         method='GET', bucket=self.bucket.name, key=self._encode_name(name),
         headers=headers,
         query_auth=self.querystring_auth, force_http=not self.secure_urls,
         response_headers=response_headers)
Exemplo n.º 15
0
 def url(self, name):
     if DIRECT_IMAGE_URL:
         if self.base_url is None:
             raise ValueError("This file is not accessible via a URL.")
         base_url = self.base_url
     else:
         base_url = settings.MEDIA_URL
     if name.startswith('/Public'):
         name = name[len('/Public') + 1:]
     return urlparse.urljoin(base_url, filepath_to_uri(name))
Exemplo n.º 16
0
 def _get_url(self, name, public=False):
     """
     Gets url for the file specified by name. Public argument defines that
     public_host or dav_host is used.
     """
     if public:
         scheme = self.scheme
         host = self.public_host
     else:
         scheme = "http"
         host = self.dav_host
     return urlparse.urljoin("%s://%s%s" % (scheme, host, self.base_url), filepath_to_uri(name))
Exemplo n.º 17
0
 def url(self, name, headers=None, response_headers=None):
     # Preserve the trailing slash after normalizing the path.
     trailing_slash = '/' if name.endswith('/') else ''
     name = self._normalize_name(self._clean_name(name)) + trailing_slash
     if self.custom_domain:
         return "%s//%s/%s" % (self.url_protocol,
                               self.custom_domain, filepath_to_uri(name))
     return self.connection.generate_url(self.querystring_expire,
         method='GET', bucket=self.bucket.name, key=self._encode_name(name),
         headers=headers,
         query_auth=self.querystring_auth, force_http=not self.secure_urls,
         response_headers=response_headers)
Exemplo n.º 18
0
 def url(self, name):
     try:
         info = self._get_info(name)
         if not info:
             raise BlobKeyRequiredError('No blob info found for %s.' % name)
         return get_serving_url(info.key())
     except (NotImageError, TransformationError):
         return None
     except BlobKeyRequiredError:
         if settings.DEBUG:
             return urlparse.urljoin(settings.MEDIA_URL, filepath_to_uri(name))
         else:
             raise
Exemplo n.º 19
0
    def url(self, name):
        if self.base_url is None:
            raise ValueError("This file is not accessible via a URL.")

        try:
            if '%s' in self.base_url:
                base_url = self.base_url % connection.schema_name
            else:
                base_url = u"{0}{1}/".format(self.base_url, connection.schema_name)
        except AttributeError:
            base_url = self.base_url

        return urljoin(base_url, filepath_to_uri(name))
Exemplo n.º 20
0
    def url(self, path):
        cache_key = 'django-imgur-url:%s' % filepath_to_uri(path)
        url = cache.get(cache_key)

        if not url:
            directory = os.path.dirname(path)
            name = os.path.basename(path)
            album = [a for a in self.albums if a.title == directory][0]
            images = self.client.get_album_images(album.id)
            image = [im for im in images if im.name == path][0]
            url = self.client.get_image(image.id).link
            cache.set(cache_key, url)

        return url
Exemplo n.º 21
0
    def size(self, path):
        cache_key = 'django-imgur-size:%s' % filepath_to_uri(path)
        size = cache.get(cache_key)

        if not size:
            directory = os.path.dirname(path)
            name = os.path.basename(path)
            album = [a for a in self.albums if a.title == directory][0]
            images = self.client.get_album_images(album.id)
            image = [im for im in images if im.name == path][0]
            size = self.client.get_image(image.id).size
            cache.set(cache_key, size)

        return size
Exemplo n.º 22
0
    def url(self, name, use_cache=True):
        if not settings.FACETS_ENABLED:
            return super(FacetsFilesMixin, self).url(name)

        # Is file compilable? then get generated name
        compiler = default_handlers.get_compiler(None, self, name)
        if compiler:
            name = compiler.new_name

        # Is file in cache?
        cached_file = use_cache and self.file_cache.get(self.cache_key(name)) or None
        if not cached_file:
            return super(FacetsFilesMixin, self).url(name)

        return urljoin(self.base_url, filepath_to_uri(cached_file))
Exemplo n.º 23
0
    def test_posix_paths(self):
        """
        Use posixpath to test posix paths independently from current os
        """
        filebrowser.base.os.path = posixpath
        site.directory = "uploads/"
        filebrowser.base.MEDIA_URL = "/media/"
        f = FileObject("uploads/$%^&*/測試文件.jpg", site=site)

        self.assertEqual(f.path_relative_directory, "$%^&*/測試文件.jpg")
        self.assertEqual(f.directory, "$%^&*/測試文件.jpg")
        self.assertEqual(f.folder, r"$%^&*")

        # Check url gets well encoded
        self.assertEqual(f.url, filepath_to_uri("/media/uploads/$%^&*/測試文件.jpg"))
Exemplo n.º 24
0
    def url(self, name, parameters=None, expire=None):
        # Preserve the trailing slash after normalizing the path.
        # TODO: Handle force_http=not self.secure_urls like in s3boto
        name = self._normalize_name(self._clean_name(name))
        if self.custom_domain:
            return "%s//%s/%s" % (self.url_protocol, self.custom_domain, filepath_to_uri(name))
        if expire is None:
            expire = self.querystring_expire

        params = parameters.copy() if parameters else {}
        params['Bucket'] = self.bucket.name
        params['Key'] = self._encode_name(name)
        url = self.bucket.meta.client.generate_presigned_url(
            'get_object', Params=params, ExpiresIn=expire
        )
        if self.querystring_auth:
            return url
        return self._strip_signing_parameters(url)
Exemplo n.º 25
0
    def __init__(self, relative_source, requested_size, opts=None,
                 quality=None, basedir=None, subdir=None, prefix=None,
                 relative_dest=None, processors=None, extension=None):

        if isinstance(relative_source, basestring):
            relative_source = force_unicode(relative_source)
            # Set the absolute filename for the source file
            source = self._absolute_path(relative_source)
        else:
            source = relative_source

        quality = get_thumbnail_setting('QUALITY', quality)
        convert_path = get_thumbnail_setting('CONVERT')
        wvps_path = get_thumbnail_setting('WVPS')
        if processors is None:
            processors = PROCESSORS #dynamic_import(get_thumbnail_setting('PROCESSORS'))

        # Call super().__init__ now to set the opts attribute. generate() won't
        # get called because we are not setting the dest attribute yet.
        super(_DjangoThumbnail, self).__init__(source, requested_size,
            opts=opts, quality=quality, convert_path=convert_path,
            wvps_path=wvps_path, processors=processors)

        # Get the relative filename for the thumbnail image, then set the
        # destination filename
        if relative_dest is None:
            relative_dest = \
               self._get_relative_thumbnail(relative_source, basedir=basedir,
                                            subdir=subdir, prefix=prefix,
                                            extension=extension)
        filelike = not isinstance(relative_dest, basestring)
        if filelike:
            self.dest = relative_dest
        else:
            self.dest = self._absolute_path(relative_dest)

        # Call generate now that the dest attribute has been set
        self.generate()

        # Set the relative & absolute url to the thumbnail
        if not filelike:
            self.relative_url = filepath_to_uri(relative_dest)
            self.absolute_url = '%s%s' % (settings.MEDIA_URL,
                                          self.relative_url)
Exemplo n.º 26
0
    def url(self, name, headers=None, response_headers=None, expire=None):
        # Preserve the trailing slash after normalizing the path.
        name = self._normalize_name(self._clean_name(name))
        if self.custom_domain:
            return "%s//%s/%s" % (self.url_protocol, self.custom_domain, filepath_to_uri(name))

        if expire is None:
            expire = self.querystring_expire

        return self.connection.generate_url(
            expire,
            method="GET",
            bucket=self.bucket.name,
            key=self._encode_name(name),
            headers=headers,
            query_auth=self.querystring_auth,
            force_http=not self.secure_urls,
            response_headers=response_headers,
        )
Exemplo n.º 27
0
    def generate_presigned_post_url(self, name, expire=3600):
        # Preserve the trailing slash after normalizing the path.
        name = self._normalize_name(self._clean_name(name))
        if self.custom_domain:
            return '%s//%s/%s' % (self.url_protocol, self.custom_domain, filepath_to_uri(name))

        if expire is None:
            expire = self.querystring_expire

        content_type, _ = guess_type(name)

        return self.connection.generate_url(
            expire,
            method='PUT',
            bucket=self.bucket.name,
            key=self._encode_name(name),
            headers={'Content-Type': content_type},
            query_auth=self.querystring_auth,
            force_http=not self.secure_urls,
            response_headers={},
        )
Exemplo n.º 28
0
 def url(self, name):
     """In-memory files aren't actually URL-accessible; we'll pretend."""
     return urlparse.urljoin(settings.MEDIA_URL, filepath_to_uri(name))
Exemplo n.º 29
0
 def url(self, name):
     return settings.FRONTEND_PROXY_URL.format(
         filename=filepath_to_uri(name))
Exemplo n.º 30
0
 def url(self, name, headers=None, response_headers=None, expire=None):
     return '{}{}'.format(settings.STATIC_URL, filepath_to_uri(name))
Exemplo n.º 31
0
 def get_thumbnail_url(self):
     """
     Returns the (absolute) URL for the image's thumbnail version.
     """
     return urljoin(settings.MEDIA_URL,
                    filepath_to_uri(self.get_thumbnail_path()))
Exemplo n.º 32
0
 def url(self):
     return self.get_file_url(filepath_to_uri(self.name))
Exemplo n.º 33
0
 def test_filepath_to_uri(self):
     self.assertEqual(filepath_to_uri('upload\\чубака.mp4'), 'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4')
Exemplo n.º 34
0
 def test_filepath_to_uri(self):
     self.assertEqual(filepath_to_uri('upload\\чубака.mp4'),
                      'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4')
     self.assertEqual(filepath_to_uri('upload\\чубака.mp4'.encode('utf-8')),
                      'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4')
Exemplo n.º 35
0
 def url(self, name):
     name = self._normalize_name(self._clean_name(name))
     name = filepath_to_uri(name)
     return '/%s' % name
Exemplo n.º 36
0
 def url(self, name):
     """In-memory files aren't actually URL-accessible; we'll pretend."""
     return urlparse.urljoin('/media/', filepath_to_uri(name))
Exemplo n.º 37
0
 def url(self, name):
     if self.base_url is None:
         raise ValueError("This file is not accessible via a URL.")
     return urlparse.urljoin(self.base_url, filepath_to_uri(name))
Exemplo n.º 38
0
 def test_filepath_to_uri(self):
     self.assertEqual(filepath_to_uri(None), None)
     self.assertEqual(filepath_to_uri('upload\\чубака.mp4'),
                      'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4')
Exemplo n.º 39
0
def create_missing_vhigh_placeholders(gallery_slug):

    gallery = Gallery.objects.get(slug=gallery_slug)

    photocustoms = []
    for p in gallery.photos.all().order_by('id'):
        photocustoms.append(PhotoCustom.objects.get(photo_id=p.id))
    n = len(photocustoms)

    print('Found %d photos in gallery "%s"\n' % (n, gallery.title))

    for i, pc in enumerate(photocustoms):

        photosize = PhotoSizeCache().sizes.get('vhigh_display_placeholder')
        if pc.size_exists(photosize):
            print('Placeholder already exists for "%s" at %s' %
                  (pc.photo.title,
                   pc._get_SIZE_url('vhigh_display_placeholder')))
            continue

        display_size = 'vhigh_display'
        photosize_display = PhotoSizeCache().sizes.get(display_size)

        if not pc.photo.size_exists(photosize_display):
            pc.photo.create_size(photosize_display)
            print('Created %s' % pc.photo._get_filename_for_size(display_size))

        i_relpath = '/'.join([
            pc.photo.cache_url(),
            filepath_to_uri(pc.photo._get_filename_for_size(display_size))
        ])
        o_relpath = '/'.join([
            pc.photo.cache_url(),
            filepath_to_uri(pc._get_filename_for_size(photosize.name))
        ])
        i_path = os.path.abspath(i_relpath[1:])
        o_path = os.path.abspath(o_relpath[1:])
        cmd = '/usr/bin/npx sqip -o {} -m {} -n {} -b {} {}'.format( \
                    o_path,
                    self.placeholder_primitive_mode,
                    self.placeholder_primitive_number,
                    self.placeholder_blur,
                    i_path)
        #cmd = '/usr/bin/npx sqip -i {} -o {} -w {} -m {} -n {} -b {}'.format( \
        #            i_path,
        #            o_path,
        #            pc.placeholder_width,
        #            pc.placeholder_primitive_mode,
        #            pc.placeholder_primitive_number,
        #            pc.placeholder_blur)
        try:
            subprocess.run(cmd.split(), timeout=180, check=True)
            print('Created a placeholder for photo "%s" (%d / %d)' %
                  (pc.photo.title, i + 1, n))
        except subprocess.CalledProcessError:
            print(
                'Creating a placeholder for %s returned a non-zero exit status!'
                % i_path)
            sys.exit()
        except subprocess.TimeoutExpired:
            print('Creating a placeholder for %s timed out!' % i_path)
            sys.exit()

        try:
            tree = ET.parse(o_path)
            root = tree.getroot()
            dimensions = root.attrib['viewBox'].split()[2:4]
            root.attrib['width'] = dimensions[0] + 'px'
            root.attrib['height'] = dimensions[1] + 'px'
            tree.write(open(o_path, 'wb'))
            print('Updated placeholder SVG dimensions')
        except Exception:
            print('Writing placeholder dimensions for %s failed!' % i_path)
        print()
Exemplo n.º 40
0
def fotos(request, path=''):
    path = unquote(path)

    if any(k in request.GET for k in ['album', 'search_album', 'search_tag']):
        # redirect old URL
        path = request.GET.get('album', '')
        q = None
        if request.GET.get('search_album'):
            q = 'album:' + request.GET.get('search_album')
        if request.GET.get('search_tag'):
            q = 'tag:' + request.GET.get('search_tag')
        url = reverse('fotos', kwargs={'path': path})
        if q is not None:
            qs = QueryDict('', mutable=True)
            qs['q'] = q
            url += '?' + qs.urlencode()
        return redirect(url, permanent=True)

    album = fEs.by_path(path)
    if album is None:
        bits = path.rsplit('/', 1)
        if len(bits) == 2:
            path = bits[0]
            name = bits[1].replace('+', ' ')
            entity = fEs.by_path_and_name(path, name)
            if entity is not None:
                # Zen Photo used + signs in the filename part of the URL.
                url = reverse('fotos', kwargs={'path': path}) \
                    + '#' + filepath_to_uri(name)
                return redirect(url, permanent=True)
        raise Http404

    if album._type != 'album':
        # This is a photo, not an album.
        # Backwards compatibility, probably to Zen Photo.
        url = reverse('fotos', kwargs={'path': album.path}) \
            + '#' + filepath_to_uri(album.name)
        return redirect(url, permanent=True)

    user = request.user if request.user.is_authenticated() else None

    if not album.may_view(user) and user is None:
        # user is not logged in
        return redirect_to_login(request.get_full_path())

    if not album.may_view(user):
        # user is logged in, but may not view the album
        title = album.title
        if not title:
            title = album.name
        # respond with a nice error message
        response = render(
            request,
            'fotos/fotos.html',
            {'fotos': {'parents': album_parents_json(album)},
             'error': 'permission-denied'},
        )
        response.status_code = 403
        return response

    if 'download' in request.GET:
        if album.is_root:
            # Downloading ALL photos would be way too much
            raise PermissionDenied
        download = ZipSeeker()
        add_download_files(download, album, album.full_path, user)
        response = StreamingHttpResponse(download.blocks(),
                                         content_type='application/zip')
        response['Content-Length'] = download.size()
        response['Last-Modified'] = http_date(download.lastModified())
        # TODO: human-readable download name?
        response['Content-Disposition'] = 'attachment; filename=' + \
            album.name + '.zip'
        return response

    people = None
    if fEs.is_admin(user):
        # Get all members (now or in the past), and sort them first
        # by whether they are active (active members first) and
        # then by their name.
        humanNames = {}
        active = []
        inactive = []
        for u in Es.users():
            humanNames[str(u.name)] = six.text_type(u.humanName)
            if u.is_active:
                active.append(str(u.name))
            else:
                inactive.append(str(u.name))
        active.sort()
        inactive.sort()
        people = []
        for name in active + inactive:
            people.append((name, humanNames[name]))

    fotos = album_json(album, user)
    return render(request, 'fotos/fotos.html',
                  {'fotos': fotos,
                   'fotos_admin': fEs.is_admin(user),
                   'people': people})
Exemplo n.º 41
0
 def url(self, name):
     name = self._normalize_name(self._clean_name(name))
     name = filepath_to_uri(name)
     protocol = 'https://' if self.secure_url else 'http://'
     return urljoin(protocol + self.bucket_domain, name)
Exemplo n.º 42
0
 def url(self, name):
     path = self._git_path(name)
     if self.base_url is None:
         raise ValueError("This file is not accessible via a URL.")
     return urljoin(self.base_url, filepath_to_uri(path))
Exemplo n.º 43
0
 def url(self, name):
     try:
         return super(DevBlobstoreStorage, self).url(name)
     except BlobKeyRequiredError:
         return urlparse.urljoin(settings.MEDIA_URL, filepath_to_uri(name))
Exemplo n.º 44
0
def test_filepath_to_uri(inp):
    filepath_to_uri(inp)
Exemplo n.º 45
0
 def url(self, name):
     return self.BASE_URL + filepath_to_uri(name)
Exemplo n.º 46
0
 def get_avatar(self, business: Business):
     if not business.avatar:
         return None
     filepath = filepath_to_uri(business.avatar.name)
     return f"{settings.MEDIA_URL}{filepath}"
Exemplo n.º 47
0
 def full_url(self, name):
     name = self._normalize_name(self._clean_name(name))
     name = filepath_to_uri(name)
     full_url = urllib.parse.urljoin(settings.REMOTE_MEDIA_URL, name)
     log.info('>>> QiniuStorage full_url: %s' % name)
     return full_url
Exemplo n.º 48
0
 def get_base_url(self):
     return filepath_to_uri("model_browser/images/textured_polyhedrons/"+self.polyhedron_mapped_to.name +"/"+self.texture_mapped_from.texture_line.name+"/")
Exemplo n.º 49
0
 def url(self, name):
     return urljoin(self.base_url, filepath_to_uri(name))
Exemplo n.º 50
0
 def url(self, name):
     if self.base_url is None:
         raise ValueError("This file is not accessible via a URL.")
     return urljoin(self.base_url, filepath_to_uri(name))
Exemplo n.º 51
0
 def _url(self, name):
     return urljoin('/', filepath_to_uri(name))