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


Python settings.EXTENSIONS类代码示例

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


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

示例1: _get_file_type

 def _get_file_type(self):
     "Get file type as defined in EXTENSIONS."
     file_type = ''
     for k, v in EXTENSIONS.iteritems():
         for extension in v:
             if self.extension.lower() == extension.lower():
                 file_type = k
     return file_type
开发者ID:gdometrics,项目名称:django-filebrowser,代码行数:8,代码来源:base.py

示例2: __init__

 def __init__(self, max_length=None, min_length=None, site=None, directory=None, extensions=None, format=None, *args, **kwargs):
     self.max_length, self.min_length = max_length, min_length
     self.site = kwargs.pop('filebrowser_site', site)
     self.directory = directory
     self.extensions = extensions
     if format:
         self.format = format or ''
         self.extensions = extensions or EXTENSIONS.get(format)
     super(FileBrowseFormField, self).__init__(*args, **kwargs)
开发者ID:sehmaschine,项目名称:django-filebrowser,代码行数:9,代码来源:fields.py

示例3: __init__

 def __init__(self, max_length=None, min_length=None, site=None, directory=None, extensions=None, format=None, upload_to=None, temp_upload_dir=None, *args, **kwargs):
     self.max_length, self.min_length = max_length, min_length
     self.site = kwargs.pop('filebrowser_site', site)
     self.directory = directory
     self.format = format or ''
     self.extensions = extensions or EXTENSIONS.get(format.title())
     self.upload_to = upload_to
     self.temp_upload_dir = temp_upload_dir
     super(FileBrowseAndUploadFormField, self).__init__(*args, **kwargs)
开发者ID:DjangoAdminHackers,项目名称:django-filebrowser-browse-upload-field,代码行数:9,代码来源:fields.py

示例4: get_file_extensions

def get_file_extensions(qs):
    extensions = []
    if "type" in qs and qs.get("type") in SELECT_FORMATS:
        for format in SELECT_FORMATS.get(qs.get("type"), []):
            extensions.extend(EXTENSIONS[format])
    else:
        for k, v in EXTENSIONS.items():
            for item in v:
                if item: extensions.append(item)
    return extensions
开发者ID:Iv,项目名称:django-filebrowser-no-grappelli,代码行数:10,代码来源:fb_tags.py

示例5: get_file_type

def get_file_type(filename):
    """
    Get file type as defined in EXTENSIONS.
    """

    file_extension = os.path.splitext(filename)[1].lower()
    file_type = ''
    for k, v in EXTENSIONS.items():
        for extension in v:
            if file_extension == extension.lower():
                file_type = k
    return file_type
开发者ID:miguelramos,项目名称:django-media-manager,代码行数:12,代码来源:functions.py

示例6: get_file_extensions

def get_file_extensions(qs):
    extensions = []
    if "type" in qs and qs.get("type") in SELECT_FORMATS:
        for format in SELECT_FORMATS.get(qs.get("type"), []):
            extensions.extend(EXTENSIONS[format])
    else:
        for k, v in EXTENSIONS.items():
            for item in v:
                if item:
                    extensions.append(item)
    extensions = '","'.join(extensions)
    extensions = '["%s"]' % extensions
    return mark_safe(extensions)
开发者ID:dteskera,项目名称:django-filebrowser-suit,代码行数:13,代码来源:fb_tags.py

示例7: __init__

    def __init__(self, max_length=None, min_length=None,
                  extensions=None, format=None, *args, **kwargs):
        self.max_length, self.min_length = max_length, min_length
        self.directory = kwargs.pop('directory', '')
        self.extensions = extensions
        self.format = format or ''
        self.extensions = extensions or EXTENSIONS.get(format)

        attrs = {
            "directory": self.directory,
            "extensions": self.extensions,
            "format": self.format
        }
        self.widget = FileBrowseWidget(attrs)
        super(FileBrowseFormField, self).__init__(*args, **kwargs)
开发者ID:miguelramos,项目名称:django-media-manager,代码行数:15,代码来源:fields.py


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