Example #1
0
 def _get_format_type(self):
     "Get format type as defined in SELECT_FORMATS."
     format_type = []
     for k, v in SELECT_FORMATS.items():
         for item in v:
             for extension in EXTENSIONS.get(item, None):
                 if self.extension.lower() == extension.lower():
                     format_type.append(k)
     return format_type
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
Example #3
0
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
Example #4
0
def is_selectable(filename, selecttype):
    """
    Get select type as defined in FORMATS.
    """

    file_extension = os.path.splitext(filename)[1].lower()
    select_types = []
    for k, v in SELECT_FORMATS.items():
        for extension in v:
            if file_extension == extension.lower():
                select_types.append(k)
    return select_types
def is_selectable(filename, selecttype):
    """
    Get select type as defined in FORMATS.
    """

    file_extension = os.path.splitext(filename)[1].lower()
    select_types = []
    for k, v in SELECT_FORMATS.items():
        for extension in v:
            if file_extension == extension.lower():
                select_types.append(k)
    return select_types
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)
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)