当前位置: 首页>>代码示例>>Python>>正文


Python urls.get_absolute_url函数代码示例

本文整理汇总了Python中taiga.base.utils.urls.get_absolute_url函数的典型用法代码示例。如果您正苦于以下问题:Python get_absolute_url函数的具体用法?Python get_absolute_url怎么用?Python get_absolute_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_absolute_url函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_big_photo_url

def get_big_photo_url(photo):
    """Get a big photo absolute url and the photo automatically cropped."""
    try:
        url = get_thumbnailer(photo)[settings.THN_AVATAR_BIG].url
        return get_absolute_url(url)
    except InvalidImageFormatError as e:
        return None
开发者ID:CrypticGator,项目名称:taiga-back,代码行数:7,代码来源:services.py

示例2: get_photo_url

def get_photo_url(photo):
    """Get a photo absolute url and the photo automatically cropped."""
    try:
        url = get_thumbnailer(photo)['avatar'].url
        return get_absolute_url(url)
    except InvalidImageFormatError as e:
        return None
开发者ID:benzaku,项目名称:taiga-back,代码行数:7,代码来源:services.py

示例3: _get_attachment_thumbnailer_url

def _get_attachment_thumbnailer_url(attachment, thumbnailer_size):
    try:
        thumb_url = get_thumbnailer(attachment.attached_file)[thumbnailer_size].url
        thumb_url = get_absolute_url(thumb_url)
    except InvalidImageFormatError:
        thumb_url = None

    return thumb_url
开发者ID:spetpet,项目名称:taiga-back,代码行数:8,代码来源:services.py

示例4: get_thumbnail_url

def get_thumbnail_url(file_obj, thumbnailer_size):
    try:
        path_url = get_thumbnailer(file_obj)[thumbnailer_size].url
        thumb_url = get_absolute_url(path_url)
    except InvalidImageFormatError:
        thumb_url = None

    return thumb_url
开发者ID:74Labs,项目名称:taiga-back,代码行数:8,代码来源:thumbnails.py

示例5: get_thumbnail_url

def get_thumbnail_url(file_obj, thumbnailer_size):
    thumbnail = get_thumbnail(file_obj, thumbnailer_size)

    if not thumbnail:
        return None

    path_url = thumbnail.url
    thumb_url = get_absolute_url(path_url)
    return thumb_url
开发者ID:taigaio,项目名称:taiga-back,代码行数:9,代码来源:thumbnails.py

示例6: get_or_generate_config

def get_or_generate_config(project):
    config = project.modules_config.config
    if config and "github" in config:
        g_config = project.modules_config.config["github"]
    else:
        g_config = {"secret": uuid.uuid4().hex}

    url = reverse("github-hook-list")
    url = get_absolute_url(url)
    url = "%s?project=%s" % (url, project.id)
    g_config["webhooks_url"] = url
    return g_config
开发者ID:cubettech,项目名称:taiga-back,代码行数:12,代码来源:services.py

示例7: get_or_generate_config

def get_or_generate_config(project):
    config = project.modules_config.config
    if config and "bitbucket" in config:
        g_config = project.modules_config.config["bitbucket"]
    else:
        g_config = {"secret": uuid.uuid4().hex, "valid_origin_ips": settings.BITBUCKET_VALID_ORIGIN_IPS}

    url = reverse("bitbucket-hook-list")
    url = get_absolute_url(url)
    url = "%s?project=%s&key=%s" % (url, project.id, g_config["secret"])
    g_config["webhooks_url"] = url
    return g_config
开发者ID:spetpet,项目名称:taiga-back,代码行数:12,代码来源:services.py

示例8: get_or_generate_config

def get_or_generate_config(project):
    config = project.modules_config.config
    if config and "gitlab" in config:
        g_config = project.modules_config.config["gitlab"]
    else:
        g_config = {
            "secret": uuid.uuid4().hex,
            "valid_origin_ips": settings.GITLAB_VALID_ORIGIN_IPS,
        }

    url = reverse("gitlab-hook-list")
    url = get_absolute_url(url)
    url = "{}?project={}&key={}".format(url, project.id, g_config["secret"])
    g_config["webhooks_url"] = url
    return g_config
开发者ID:74Labs,项目名称:taiga-back,代码行数:15,代码来源:services.py

示例9: extract_attachments

def extract_attachments(obj) -> list:
    for attach in obj.attachments.all():
        try:
            thumb_url = get_thumbnailer(attach.attached_file)['timeline-image'].url
            thumb_url = get_absolute_url(thumb_url)
        except InvalidImageFormatError as e:
            thumb_url = None

        yield {"id": attach.id,
               "filename": os.path.basename(attach.attached_file.name),
               "url": attach.attached_file.url,
               "thumb_url": thumb_url,
               "is_deprecated": attach.is_deprecated,
               "description": attach.description,
               "order": attach.order}
开发者ID:jinanwang,项目名称:taiga-back,代码行数:15,代码来源:freeze_impl.py

示例10: get_thumbnail_url

def get_thumbnail_url(file_obj, thumbnailer_size):
    # Ugly hack to temporary ignore tiff files
    relative_name = file_obj
    if isinstance(file_obj, FieldFile):
        relative_name = file_obj.name

    source_extension = os.path.splitext(relative_name)[1][1:]
    if source_extension == "tiff":
        return None

    try:
        path_url = get_thumbnailer(file_obj)[thumbnailer_size].url
        thumb_url = get_absolute_url(path_url)
    except InvalidImageFormatError:
        thumb_url = None

    return thumb_url
开发者ID:ldf92,项目名称:taiga-back,代码行数:17,代码来源:thumbnails.py

示例11: get_gravatar_url

def get_gravatar_url(email: str, **options) -> str:
    """Get the gravatar url associated to an email.

    :param options: Additional options to gravatar.
    - `default` defines what image url to show if no gravatar exists
    - `size` defines the size of the avatar.
    By default the `settings.GRAVATAR_DEFAULT_OPTIONS` are used.

    :return: Gravatar url.
    """
    defaults = settings.GRAVATAR_DEFAULT_OPTIONS.copy()
    default = defaults.get("default", None)
    if default:
        defaults["default"] = get_absolute_url(default)
    defaults.update(options)
    email_hash = hashlib.md5(email.lower().encode()).hexdigest()
    url = GRAVATAR_BASE_URL.format(email_hash, urlencode(defaults))

    return url
开发者ID:yamila-moreno,项目名称:taiga-back,代码行数:19,代码来源:gravatar.py

示例12: test_get_absolute_url

def test_get_absolute_url():
    site = sites.get_current()
    assert get_absolute_url("http://domain/path") == "http://domain/path"
    assert get_absolute_url("/path") == build_url("/path", domain=site.domain, scheme=site.scheme)
开发者ID:6ft,项目名称:taiga-back,代码行数:4,代码来源:test_utils.py

示例13: get_photo_url

def get_photo_url(photo):
    """Get a photo absolute url and the photo automatically cropped."""
    url = get_thumbnailer(photo)['avatar'].url
    return get_absolute_url(url)
开发者ID:yamila-moreno,项目名称:taiga-back,代码行数:4,代码来源:services.py


注:本文中的taiga.base.utils.urls.get_absolute_url函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。