當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。