[Python-modules-commits] [flask-autoindex] 02/05: Update tracked files

Jonathan Cristopher Carter jcc at moszumanska.debian.org
Wed Sep 6 08:22:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

jcc pushed a commit to branch master
in repository flask-autoindex.

commit 94d72b4362176b1398d5702c7e36a9870db1e26c
Author: Jonathan Carter <jcarter at linux.com>
Date:   Wed Sep 6 10:21:45 2017 +0200

    Update tracked files
---
 flask_autoindex/__init__.py                        | 276 -----------------
 flask_autoindex/entry.py                           | 332 ---------------------
 flask_autoindex/icons.py                           |  81 -----
 flask_autoindex/run.py                             |  10 -
 flask_autoindex/static/asc.gif                     | Bin 53 -> 0 bytes
 flask_autoindex/static/autoindex.css               | 171 -----------
 flask_autoindex/static/desc.gif                    | Bin 53 -> 0 bytes
 .../templates/__autoindex__/autoindex.html         |  42 ---
 .../templates/__autoindex__/macros.html            |  70 -----
 tests/__init__.py                                  | 287 ------------------
 tests/blueprinttest/__init__.py                    |   2 -
 tests/static/helloworld.txt                        |   1 -
 tests/static/test.7z                               |   0
 tests/static/test.ai                               |   0
 tests/static/test.alz                              |   0
 tests/static/test.app                              |   0
 tests/static/test.applescript                      |   0
 tests/static/test.asp                              |   0
 tests/static/test.avi                              |   0
 tests/static/test.bak                              |   0
 tests/static/test.bat                              |   0
 tests/static/test.bin                              |   0
 tests/static/test.bmp                              |   0
 tests/static/test.bup                              |   0
 tests/static/test.c                                |   0
 tests/static/test.cab                              |   0
 tests/static/test.cer                              |   0
 tests/static/test.cfg                              |   0
 tests/static/test.cgi                              |   0
 tests/static/test.com                              |   0
 tests/static/test.conf                             |   0
 tests/static/test.cpl                              |   0
 tests/static/test.cpp                              |   0
 tests/static/test.css                              |   0
 tests/static/test.csv                              |   0
 tests/static/test.cur                              |   0
 tests/static/test.db                               |   0
 tests/static/test.dll                              |   0
 tests/static/test.dmg                              |   0
 tests/static/test.doc                              |   0
 tests/static/test.docx                             |   0
 tests/static/test.eps                              |   0
 tests/static/test.exe                              |   0
 tests/static/test.fla                              |   0
 tests/static/test.flv                              |   0
 tests/static/test.gif                              |   0
 tests/static/test.h                                |   0
 tests/static/test.htm                              |   0
 tests/static/test.html                             |   0
 tests/static/test.hwp                              |   0
 tests/static/test.ico                              |   0
 tests/static/test.ics                              |   0
 tests/static/test.ini                              |   0
 tests/static/test.iso                              |   0
 tests/static/test.jar                              |   0
 tests/static/test.java                             |   0
 tests/static/test.jpeg                             |   0
 tests/static/test.jpg                              |   0
 tests/static/test.js                               |   0
 tests/static/test.json                             |   0
 tests/static/test.jsp                              |   0
 tests/static/test.less                             |   0
 tests/static/test.log                              |   0
 tests/static/test.markdown                         |   0
 tests/static/test.md                               |   0
 tests/static/test.mid                              |   0
 tests/static/test.mov                              |   0
 tests/static/test.mp3                              |   0
 tests/static/test.mp4                              |   0
 tests/static/test.mpa                              |   0
 tests/static/test.mpeg                             |   0
 tests/static/test.mpg                              |   0
 tests/static/test.pdf                              |   0
 tests/static/test.php                              |   0
 tests/static/test.pkg                              |   0
 tests/static/test.png                              |   0
 tests/static/test.ppt                              |   0
 tests/static/test.pptx                             |   0
 tests/static/test.psd                              |   0
 tests/static/test.py                               |   0
 tests/static/test.rar                              |   0
 tests/static/test.rb                               |   0
 tests/static/test.rss                              |   0
 tests/static/test.rtf                              |   0
 tests/static/test.sh                               |   0
 tests/static/test.smi                              |   0
 tests/static/test.sql                              |   0
 tests/static/test.svg                              |   0
 tests/static/test.swf                              |   0
 tests/static/test.sys                              |   0
 tests/static/test.tar                              |   0
 tests/static/test.tar.gz                           |   0
 tests/static/test.tgz                              |   0
 tests/static/test.tif                              |   0
 tests/static/test.tmp                              |   0
 tests/static/test.toast                            |   0
 tests/static/test.torrent                          |   0
 tests/static/test.ttf                              |   0
 tests/static/test.txt                              |   0
 tests/static/test.vb                               |   0
 tests/static/test.vcd                              |   0
 tests/static/test.vcf                              |   0
 tests/static/test.wav                              |   0
 tests/static/test.wmv                              |   0
 tests/static/test.xhtml                            |   0
 tests/static/test.xls                              |   0
 tests/static/test.xlsx                             |   0
 tests/static/test.xml                              |   0
 tests/static/test.xsl                              |   0
 tests/static/test.yml                              |   0
 tests/static/test.zip                              |   0
 111 files changed, 1272 deletions(-)

diff --git a/flask_autoindex/__init__.py b/flask_autoindex/__init__.py
deleted file mode 100644
index 136fd61..0000000
--- a/flask_autoindex/__init__.py
+++ /dev/null
@@ -1,276 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-    flask_autoindex
-    ~~~~~~~~~~~~~~~
-
-    The mod_autoindex for `Flask <http://flask.pocoo.org/>`_.
-
-    :copyright: (c) 2010-2013 by Heungsub Lee.
-    :license: BSD, see LICENSE for more details.
-"""
-from __future__ import absolute_import
-from future.builtins import str
-from future.builtins import object
-import os
-import re
-
-from flask import *
-from flask_silk import Silk
-from jinja2 import FileSystemLoader, TemplateNotFound
-from werkzeug import cached_property
-
-from .entry import *
-from . import icons
-
-
-__version__ = '0.5'
-__autoindex__ = '__autoindex__'
-
-
-class AutoIndex(object):
-    """This class makes the Flask application to serve automatically
-    generated index page. The wrapped application will route ``/`` and
-    ``/<path:path>`` when ``add_url_rules`` is ``True``. Here's a simple
-    example::
-
-        app = Flask(__name__)
-        AutoIndex(app, '/home/someone/public_html', add_url_rules=True)
-
-    :param base: a Flask application.
-    :param browse_root: a path which is served by root address. By default,
-                        this is the working directory, but you can set it to
-                        fix your app to always use one location if you like.
-    :param add_url_rules: if it is ``True``, the wrapped application routes
-                          ``/`` and ``/<path:path>`` to autoindex. default
-                          is ``True``.
-    :param template_context: would be passed to the Jinja2 template when
-                             rendering an AutoIndex page.
-    :param silk_options: keyword options for :class:`flask_silk.Silk`.
-    """
-
-    shared = None
-
-    def _register_shared_autoindex(self, state=None, app=None):
-        """Registers a magic module named __autoindex__."""
-        app = app or state.app
-        if __autoindex__ not in app.blueprints:
-            static_folder = os.path.join(__path__[0], 'static')
-            template_folder = os.path.join(__path__[0], 'templates')
-            shared = Blueprint(__autoindex__, __name__,
-                               template_folder=template_folder)
-            @shared.route('/__autoindex__/<path:filename>')
-            def static(filename):
-                return send_from_directory(static_folder, filename)
-            app.register_blueprint(shared)
-
-    def __new__(cls, base, *args, **kwargs):
-        if isinstance(base, Flask):
-            return object.__new__(AutoIndexApplication)
-        elif isinstance(base, Blueprint):
-            return object.__new__(AutoIndexBlueprint)
-        else:
-            raise TypeError("'base' should be Flask or Blueprint.")
-
-    def __init__(self, base, browse_root=None, add_url_rules=True,
-                 template_context=None, silk_options=None,
-                 show_hidden=False):
-        """Initializes an autoindex instance."""
-        self.base = base
-        if browse_root:
-            browse_root = str(browse_root)
-        else:
-            browse_root = os.path.curdir
-        self.rootdir = RootDirectory(browse_root, autoindex=self)
-        self.template_context = template_context
-        if silk_options is None:
-            silk_options = {}
-        silk_options['silk_path'] = silk_options.get('silk_path', '/__icons__')
-        self.silk = Silk(self.base, **silk_options)
-        self.show_hidden = show_hidden
-        self.icon_map = []
-        self.converter_map = []
-        if add_url_rules:
-            @self.base.route('/')
-            @self.base.route('/<path:path>')
-            def autoindex(path='.'):
-                return self.render_autoindex(path)
-
-    def render_autoindex(self, path, browse_root=None, template=None,
-                         template_context=None, endpoint='.autoindex',
-                         show_hidden=None, sort_by='name',
-                         mimetype=None):
-        """Renders an autoindex with the given path.
-
-        :param path: the relative path.
-        :param browse_root: if it is specified, it used to a path which is
-                            served by root address.
-        :param template: the template name.
-        :param template_context: would be passed to the Jinja2 template when
-                                 rendering an AutoIndex page.
-        :param endpoint: an endpoint which is a function.
-        :param show_hidden: whether to show hidden files (starting with '.')
-        :param sort_by: the property to sort the entrys by.
-        :param mimetype: set static mime type for files (no auto detection).
-        """
-        if browse_root:
-            rootdir = RootDirectory(browse_root, autoindex=self)
-        else:
-            rootdir = self.rootdir
-        path = re.sub(r'\/*$', '', path)
-        abspath = os.path.join(rootdir.abspath, path)
-        if os.path.isdir(abspath):
-            sort_by = request.args.get('sort_by', sort_by)
-            order = {'asc': 1, 'desc': -1}[request.args.get('order', 'asc')]
-            curdir = Directory(path, rootdir)
-            if show_hidden == None: show_hidden = self.show_hidden
-            entries = curdir.explore(sort_by=sort_by, order=order,
-                                     show_hidden=show_hidden)
-            if callable(endpoint):
-                endpoint = endpoint.__name__
-            context = {}
-            if template_context is not None:
-                context.update(template_context)
-            if self.template_context is not None:
-                context.update(self.template_context)
-            context.update(
-                curdir=curdir, entries=entries,
-                sort_by=sort_by, order=order, endpoint=endpoint)
-            if template:
-                return render_template(template, **context)
-            try:
-                template = '{0}autoindex.html'.format(self.template_prefix)
-                return render_template(template, **context)
-            except TemplateNotFound as e:
-                template = '{0}/autoindex.html'.format(__autoindex__)
-                return render_template(template, **context)
-        elif os.path.isfile(abspath):
-            if mimetype:
-                return send_file(abspath, mimetype=mimetype)
-            else:
-                return send_file(abspath)
-        else:
-            return abort(404)
-
-    def add_icon_rule(self, icon, rule=None, ext=None, mimetype=None,
-                      name=None, filename=None, dirname=None, cls=None):
-        """Adds a new icon rule.
-
-        There are many shortcuts for rule. You can use one or more shortcuts in
-        a rule.
-
-        `rule`
-            A function which returns ``True`` or ``False``. It has one argument
-            which is an instance of :class:`Entry`. Example usage::
-
-                def has_long_name(ent):
-                    return len(ent.name) > 10
-                idx.add_icon_rule('brick.png', rule=has_log_name)
-
-            Now the application represents files or directorys such as
-            ``very-very-long-name.js`` with ``brick.png`` icon.
-
-        `ext`
-            A file extension or file extensions to match with a file::
-
-                idx.add_icon_rule('ruby.png', ext='ruby')
-                idx.add_icon_rule('bug.png', ext=['bug', 'insect'])
-
-        `mimetype`
-            A mimetype or mimetypes to match with a file::
-
-                idx.add_icon_rule('application.png', mimetype='application/*')
-                idx.add_icon_rule('world.png', mimetype=['image/icon', 'x/*'])
-
-        `name`
-            A name or names to match with a file or directory::
-
-                idx.add_icon_rule('error.png', name='error')
-                idx.add_icon_rule('database.png', name=['mysql', 'sqlite'])
-
-        `filename`
-            Same as `name`, but it matches only a file.
-
-        `dirname`
-            Same as `name`, but it matches only a directory.
-
-        If ``icon`` is callable, it is used to ``rule`` function and the result
-        is used to the url for an icon. This way is useful for getting an icon
-        url dynamically. Here's a nice example::
-
-            def get_favicon(ent):
-                favicon = 'favicon.ico'
-                if type(ent) is Directory and favicon in ent:
-                    return '/' + os.path.join(ent.path, favicon)
-                return False
-            idx.add_icon_rule(get_favicon)
-
-        Now a directory which has a ``favicon.ico`` guesses the ``favicon.ico``
-        instead of silk's ``folder.png``.
-        """
-        if name:
-            filename = name
-            directoryname = name
-        call = lambda m, *args: m.__func__(self, *args)
-        if ext:
-            call(File.add_icon_rule_by_ext, icon, ext)
-        if mimetype:
-            call(File.add_icon_rule_by_mimetype, icon, mimetype)
-        if filename:
-            call(File.add_icon_rule_by_name, icon, filename)
-        if dirname:
-            call(Directory.add_icon_rule_by_name, icon, dirname)
-        if cls:
-            call(Entry.add_icon_rule_by_class, icon, cls)
-        if callable(rule) or callable(icon):
-            call(Entry.add_icon_rule, icon, rule)
-
-    @property
-    def template_prefix(self):
-        raise NotImplementedError()
-
-
-class AutoIndexApplication(AutoIndex):
-    """An AutoIndex which supports flask applications."""
-
-    template_prefix = ''
-
-    def __init__(self, app, browse_root=None, **silk_options):
-        super(AutoIndexApplication, self).__init__(app, browse_root,
-                                                   **silk_options)
-        self.app = app
-        self._register_shared_autoindex(app=self.app)
-
-
-class AutoIndexBlueprint(AutoIndex):
-    """An AutoIndex which supports flask blueprints.
-
-    .. versionadded:: 0.3.1
-    """
-
-    def __init__(self, blueprint, browse_root=None, **silk_options):
-        super(AutoIndexBlueprint, self).__init__(blueprint, browse_root,
-                                                 **silk_options)
-        self.blueprint = self.base
-        self.blueprint.record_once(self._register_shared_autoindex)
-
-    @cached_property
-    def template_prefix(self):
-        return self.blueprint.name + '/'
-
-
-class AutoIndexModule(AutoIndexBlueprint):
-    """Deprecated module support.
-
-    .. versionchanged:: 0.3.1
-       ``AutoIndexModule`` was deprecated. Use ``AutoIndexBlueprint`` instead.
-    """
-
-    def __init__(self, *args, **kwargs):
-        import warnings
-        warnings.warn('AutoIndexModule is deprecated; ' \
-                      'use AutoIndexBlueprint instead.', DeprecationWarning)
-        super(AutoIndexModule, self).__init__(*args, **kwargs)
-
-    @property
-    def mod(self):
-        return self.blueprint
diff --git a/flask_autoindex/entry.py b/flask_autoindex/entry.py
deleted file mode 100644
index 3bf6114..0000000
--- a/flask_autoindex/entry.py
+++ /dev/null
@@ -1,332 +0,0 @@
-from past.builtins import cmp
-from future import standard_library
-standard_library.install_hooks()
-# -*- coding: utf-8 -*-
-from datetime import datetime
-from fnmatch import fnmatch
-from mimetypes import guess_type
-import functools
-import os
-import re
-from future.utils import with_metaclass
-from future.moves.urllib.parse import urljoin
-from flask import url_for, send_file
-from werkzeug import cached_property
-
-
-Default = None
-
-
-is_same_path = lambda x, y: os.stat(x) == os.stat(y)
-
-
-def _make_mimetype_matcher(mimetype):
-    return lambda ent: fnmatch(guess_type(ent.name)[0] or '', mimetype)
-
-
-def _make_args_for_entry(args, kwargs):
-    if not args:
-        raise TypeError('path is required, but not given')
-    rootdir = autoindex = None
-    args = list(args)
-    try:
-        path = kwargs.get('path', args.pop(0))
-        rootdir = kwargs.get('rootdir', args.pop(0))
-        autoindex = kwargs.get('autoindex', args.pop(0))
-    except IndexError:
-        pass
-    return (path, rootdir, autoindex)
-
-
-class _EntryMeta(type):
-    """The meta class for :class:`Entry`."""
-
-    def __call__(cls, *args, **kwargs):
-        """If an instance already initialized, just returns."""
-        ent = cls.__new__(cls, *args, **kwargs)
-        try:
-            ent.path
-        except AttributeError:
-            ent.__init__(*args, **kwargs)
-        return ent
-
-
-class Entry(with_metaclass(_EntryMeta, object)):
-    """This class wraps file or directory. It is an abstract class, but it
-    returns a derived instance. You can make an instance such as::
-
-        directory = Entry('/home/someone/public_html')
-        assert isinstance(foler, Directory)
-        file = Entry('/home/someone/public_html/favicon.ico')
-        assert isinstance(file, File)
-    """
-
-    HIDDEN = re.compile('^\.')
-
-    def __new__(cls, *args, **kwargs):
-        """Returns a file or directory instance."""
-        path, rootdir, autoindex = _make_args_for_entry(args, kwargs)
-        if rootdir:
-            abspath = os.path.join(rootdir.abspath, path)
-        else:
-            abspath = os.path.abspath(path)
-        if os.path.isdir(abspath):
-            return Directory.__new__(Directory, path, rootdir, autoindex)
-        elif os.path.isfile(abspath):
-            return File.__new__(File, path, rootdir, autoindex)
-        else:
-            raise IOError('{0} does not exists.'.format(abspath))
-
-    def __init__(self, path, rootdir=None, autoindex=None):
-        """Initializes an entry instance."""
-        self.rootdir = rootdir
-        self.autoindex = autoindex
-        try:
-            rootpath = self.rootdir.abspath
-            if not autoindex and self.rootdir:
-                self.autoindex = self.rootdir.autoindex
-        except AttributeError:
-            rootpath = ''
-        self.path = path
-        self.abspath = os.path.join(rootpath, self.path)
-        self.name = os.path.basename(self.abspath)
-        self.hidden = bool(self.HIDDEN.match(self.name))
-        if self.rootdir:
-            self.rootdir._register_descendant(self)
-
-    def is_root(self):
-        """Returns ``True`` if it is a root directory."""
-        return isinstance(self, RootDirectory)
-
-    @property
-    def parent(self):
-        if self.is_root():
-            return None
-        elif is_same_path(os.path.dirname(self.abspath), self.rootdir.abspath):
-            return self.rootdir
-        return Entry(os.path.dirname(self.path), self.rootdir)
-
-    @property
-    def modified(self):
-        """Returns modified time of this."""
-        return datetime.fromtimestamp(os.path.getmtime(self.abspath))
-
-    @classmethod
-    def add_icon_rule(cls, icon, rule=None):
-        """Adds a new icon rule globally."""
-        cls.icon_map.append((icon, rule))
-
-    @classmethod
-    def add_icon_rule_by_name(cls, icon, name):
-        """Adds a new icon rule by the name globally."""
-        cls.add_icon_rule(icon, lambda ent: ent.name == name)
-
-    @classmethod
-    def add_icon_rule_by_class(cls, icon, _class):
-        """Adds a new icon rule by the class globally."""
-        cls.add_icon_rule(icon, lambda ent: isinstance(ent, _class))
-
-    def guess_icon(self):
-        """Guesses an icon from itself."""
-        def get_icon_url():
-            try:
-                if self.autoindex:
-                    icon_map = self.autoindex.icon_map + self.icon_map
-                else:
-                    icon_map = self.icon_map
-                for icon, rule in icon_map:
-                    if not rule and callable(icon):
-                        matched = icon = icon(self)
-                    else:
-                        matched = rule(self)
-                    if matched:
-                        return icon
-            except AttributeError:
-                pass
-            try:
-                return self.default_icon
-            except AttributeError:
-                raise GuessError('There is no matched icon.')
-        try:
-            return urljoin(url_for('.silkicon', filename=''), get_icon_url())
-        except (AttributeError, RuntimeError):
-            return 'ERROR'
-            return get_icon_url()
-
-
-class File(Entry):
-    """This class wraps a file."""
-
-    EXTENSION = re.compile('\.([^.]+)$')
-
-    default_icon = 'page_white.png'
-    icon_map = []
-
-    def __new__(cls, path, rootdir=None, autoindex=None):
-        try:
-            return rootdir._descendants[(path, autoindex)]
-        except (AttributeError, KeyError):
-            pass
-        return object.__new__(cls)
-
-    def __init__(self, path, rootdir=None, autoindex=None):
-        super(File, self).__init__(path, rootdir, autoindex)
-        try:
-            self.ext = re.search(self.EXTENSION, self.name).group(1)
-        except AttributeError:
-            self.ext = None
-
-    @cached_property
-    def data(self):
-        """Data of this file."""
-        with open(self.abspath) as f:
-            return ''.join(f.readlines())
-
-    @cached_property
-    def mimetype(self):
-        """A mimetype of this file."""
-        return guess_type(self.abspath)
-
-    @cached_property
-    def size(self):
-        """A size of this file."""
-        return os.path.getsize(self.abspath)
-
-    @classmethod
-    def add_icon_rule_by_ext(cls, icon, ext):
-        """Adds a new icon rule by the file extension globally."""
-        cls.add_icon_rule(icon, lambda ent: ent.ext == ext)
-
-    @classmethod
-    def add_icon_rule_by_mimetype(cls, icon, mimetype):
-        """Adds a new icon rule by the mimetype globally."""
-        cls.add_icon_rule(icon, _make_mimetype_matcher(mimetype))
-
-
-class Directory(Entry):
-    """This class wraps a directory."""
-
-    default_icon = 'folder.png'
-    icon_map = []
-
-    def __new__(cls, *args, **kwargs):
-        """If the path is same with root path, it returns a
-        :class:`RootDirectory` object.
-        """
-        path, rootdir, autoindex = _make_args_for_entry(args, kwargs)
-        if not rootdir:
-            return RootDirectory(path, autoindex)
-        try:
-            return rootdir._descendants[(path, autoindex)]
-        except KeyError:
-            pass
-        rootpath = rootdir.abspath
-        if is_same_path(os.path.join(rootpath, path), rootpath):
-            if not rootdir:
-                rootdir = RootDirectory(rootpath, autoindex)
-            return rootdir
-        return object.__new__(cls)
-
-    def explore(self, sort_by='name', order=1, show_hidden=False):
-        """It is a generator. Each item is a child entry."""
-
-        def compare(ent1, ent2):
-            def asc():
-                if sort_by != 'modified' and type(ent1) is not type(ent2):
-                    return 1 if type(ent1) is File else -1
-                else:
-                    try:
-                        return cmp(getattr(ent1, sort_by),
-                                   getattr(ent2, sort_by))
-                    except AttributeError:
-                        return cmp(getattr(ent1, 'name'),
-                                   getattr(ent2, 'name'))
-            return asc() * order
-        if not self.is_root():
-            yield _ParentDirectory(self)
-            rootdir = self.rootdir
-        else:
-            rootdir = self
-        dirlist = os.listdir(self.abspath)
-        entries = []
-        for name in dirlist:
-            try:
-                entries.append(Entry(os.path.join(self.path, name), rootdir))
-            except IOError:
-                continue  # ignore stuff like broken links
-        entries = sorted(entries, key=functools.cmp_to_key(compare))
-        for ent in entries:
-            if show_hidden or not ent.hidden:
-                yield ent
-
-    def get_child(self, childname):
-        """Returns a child file or directory."""
-        if childname in self:
-            if self.path != '.':
-                path = os.path.join(self.path, childname)
-            else:
-                path = childname
-            return Entry(path, self.rootdir)
-        else:
-            raise IOError('{0} does not exist'.format(childname))
-
-    def __contains__(self, path_or_entry):
-        """Checks this directory has a file or directory.
-
-            public_html = Directory('public_html')
-            'favicon.ico' in public_html
-            File('favicon.ico', public_html) in public_html
-        """
-        if isinstance(path_or_entry, Entry):
-            path = os.path.relpath(path_or_entry.path, self.path)
-            if os.path.pardir in path:
-                return False
-        else:
-            path = path_or_entry
-        return os.path.exists(os.path.join(self.abspath, path))
-
-
-class RootDirectory(Directory):
-    """This class wraps a root directory."""
-
-    default_icon = 'server.png'
-    icon_map = []
-    _rootdirs = {}
-
-    def __new__(cls, path, autoindex=None):
-        try:
-            return RootDirectory._rootdirs[(path, autoindex)]
-        except KeyError:
-            return object.__new__(cls)
-
-    def __init__(self, path, autoindex=None):
-        super(RootDirectory, self).__init__('.', autoindex=autoindex)
-        self.abspath = os.path.abspath(path)
-        self.rootdir = self
-        self._descendants = {}
-        RootDirectory._register_rootdir(self)
-
-    @classmethod
-    def _register_rootdir(cls, rootdir):
-        cls._rootdirs[(rootdir.abspath, rootdir.autoindex)] = rootdir
-
-    def _register_descendant(self, entry):
-        self._descendants[(entry.path, entry.autoindex)] = entry
-
-
-class _ParentDirectory(Directory):
-    """This class wraps a parent directory."""
-
-    default_icon = 'arrow_turn_up.png'
-    icon_map = []
-
-    def __new__(cls, *args, **kwargs):
-        return object.__new__(cls)
-
-    def __init__(self, child_directory):
-        path = os.path.join(child_directory.path, '..')
-        super(_ParentDirectory, self).__init__(path, child_directory.rootdir)
-
-
-class GuessError(RuntimeError): pass
-class MarkupError(RuntimeError): pass
diff --git a/flask_autoindex/icons.py b/flask_autoindex/icons.py
deleted file mode 100644
index 6ca51ac..0000000
--- a/flask_autoindex/icons.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-
-from .entry import File, Default
-
-
-by_extension = [
-    ('page_white_python.png', 'py'),
-    ('python.png', 'pyc'),
-    ('page_white_text_width.png', ['md', 'markdown', 'rst', 'rtf']),
-    ('page_white_code.png', ['html', 'htm', 'cgi']),
-    ('page_white_visualstudio.png', ['asp', 'vb']),
-    ('page_white_ruby.png', 'rb'),
-    ('page_code.png', 'xhtml'),
-    ('page_white_code_red.png', ['xml', 'xsl', 'xslt', 'yml']),
-    ('script.png', ['js', 'json', 'applescript', 'htc']),
-    ('layout.png', ['css', 'less']),
-    ('page_white_php.png', 'php'),
-    ('page_white_c.png', 'c'),
-    ('page_white_cplusplus.png', 'cpp'),
-    ('page_white_h.png', 'h'),
-    ('database.png', ['db', 'sqlite', 'sqlite3']),
-    ('page_white_database.png', 'sql'),
-    ('page_white_gear.png', ['conf', 'cfg', 'ini', 'reg', 'sys']),
-    ('page_white_zip.png', ['zip', 'tar', 'gz', 'tgz', '7z', 'alz', 'rar', \
-                            'bin', 'cab']),
-    ('cup.png', 'jar'),
-    ('page_white_cup.png', ['java', 'jsp']),
-    ('application_osx_terminal.png', 'sh'),
-    ('page_white_acrobat.png', 'pdf'),
-    ('package.png', ['pkg', 'dmg']),
-    ('shape_group.png', ['ai', 'svg', 'eps']),
-    ('application_osx.png', 'app'),
-    ('cursor.png', 'cur'),
-    ('feed.png', 'rss'),
-    ('cd.png', ['iso', 'vcd', 'toast']),
-    ('page_white_powerpoint.png', ['ppt', 'pptx']),
-    ('page_white_excel.png', ['xls', 'xlsx', 'csv']),
-    ('page_white_word.png', ['doc', 'docx']),
-    ('page_white_flash.png', 'swf'),
-    ('page_white_actionscript.png', ['fla', 'as']),
-    ('comment.png', 'smi'),
-    ('disk.png', ['bak', 'bup']),
-    ('application_xp_terminal.png', ['bat', 'com']),
-    ('application.png', 'exe'),
-    ('key.png', 'cer'),
-    ('cog.png', ['dll', 'so']),
-    ('pictures.png', 'ics'),
-    ('error.png', 'log'),
-    ('music.png', 'mpa'),
-    ('font.png', ['ttf', 'eot']),
-    ('vcard.png', 'vcf'),
-    ('page_white.png', Default)
-]
-by_filename = [
-    ('page_white_gear.png', ['Makefile', 'Rakefile'])
-]
-by_mimetype = [
-    ('page_white_text.png', 'text/*'),
-    ('picture.png', 'image/*'),
-    ('music.png', 'audio/*'),
-    ('film.png', 'video/*')
-]
-
-
-def to_list(val):
-    if not isinstance(val, list):
-        return [val]
-    else:
-        return val
-
-
-for icon, exts in by_extension:
-    for ext in to_list(exts):
-        File.add_icon_rule_by_ext(icon, ext)
-for icon, filenames in by_filename:
-    for name in to_list(filenames):
-        File.add_icon_rule_by_name(icon, name)
-for icon, mimetypes in by_mimetype:
-    for mimetype in to_list(mimetypes):
-        File.add_icon_rule_by_mimetype(icon, mimetype)
diff --git a/flask_autoindex/run.py b/flask_autoindex/run.py
deleted file mode 100644
index 11e8e42..0000000
--- a/flask_autoindex/run.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import os.path
-from flask import Flask
-from flask_autoindex import AutoIndex
-
-
-app = Flask(__name__)
-AutoIndex(app)
-
-if __name__ == '__main__':
-    app.run()
diff --git a/flask_autoindex/static/asc.gif b/flask_autoindex/static/asc.gif
deleted file mode 100644
index 6c37a33..0000000
Binary files a/flask_autoindex/static/asc.gif and /dev/null differ
diff --git a/flask_autoindex/static/autoindex.css b/flask_autoindex/static/autoindex.css
deleted file mode 100644
index 44cade0..0000000
--- a/flask_autoindex/static/autoindex.css
+++ /dev/null
@@ -1,171 +0,0 @@
-* {
-  margin: 0;
-  padding: 0;
-  border: none;
-}
-
-body, table {
-  font-family: Helvetica, Arial, sans-serif;
-  font-size: 14px;
-}
-
-a:link, a:visited {
-  text-decoration: none;
-}
-a:link {
-  color: #36c;
-}
-a:visited {
-  color: #333;
-}
-a:hover {
-  text-decoration: underline;
-}
-
-#readme {
-  padding: 10px 26px;
-  border-bottom: 1px solid #eee;
-  font-size: 12px;
-  color: #333;
-  background: #fafafa;
-}
-#readme pre {
-  line-height: 1.2;
-}
-#readme p, #readme ul, #readme ol,
-#readme h1, #readme h2, #readme h3, #readme h4, #readme h5, #readme h6 {
-  display: block;
-  margin-bottom: 1em;
-}
-#readme h1, #readme h2, #readme h3, #readme h4, #readme h5, #readme h6 {
-  padding: 0;
-  color: #456;
-  text-align: left;
-  font-family: sans-serif;
-  font-weight: bolder;
-}
-#readme pre code {
-  display: block;
-  padding: 9px;
-  margin: 0 -10px 1em;
-  border: 1px solid #cde;
-  color: #567;
-  background: #fff;
-}
-#readme li {
-  margin-left: 2em;
-}
-#readme blockquote {
-  padding: 9px;
-  margin: 0 -10px 1em;
-  border-left: 1px solid #cde;
-}
-#readme blockquote :last-child {
-  margin-bottom: 0;
-}
-#readme h1 { font-size: 1.5em; }
-#readme h2 { font-size: 1.4em; }
-#readme h3 { font-size: 1.3em; }
-#readme h4 { font-size: 1.2em; }
-#readme h5 { font-size: 1.1em; }
-#readme h6 { font-size: 1em; }
-
-.breadcrumb {
-  padding: 0;
-}
-.breadcrumb a {
-  margin: 0;
-  color: #666;
-  font-size: 12px;
-}
-.breadcrumb .sep {
-  color: #bbb;
-}
-.breadcrumb img {
-  vertical-align: middle;
-}
-.breadcrumb h1 {
-  font-size: 12px;
-  font-weight: normal;
-  padding: 5px;
-  background: #f4f4f4;
-  border-top: 1px solid #ccc;
-}
-
-table {
-  border-collapse: collapse;
-  width: 100%;
-  background: #fff;
-}
-thead {
-  border-bottom: 1px solid #ccc;
-}
-th {
-  font-size: 11px;
-  height: 30px;
-  background: #ddd;
-  background: -webkit-gradient(
-    linear,
-    left bottom,
-    left top,
-    color-stop(0, #ddd),
-    color-stop(1, #eee)
-  );
-  background: -moz-linear-gradient(
-    center bottom,
-    #ddd 0%,
-    #eee 100%
-  );
-}
-th a:link, th a:visited {
-  margin: 0 10px;
-  color: #333;
-}
-th img {
-  position: absolute;
-  margin-left: -6px;
-}
-tbody {
-  border: solid #ccc;
-  border-width: 1px 0;
-}
-hr {
-  margin: 0;
-  border: none;
-}
-td {
-  padding: 5px;
-  font-size: 11px;
-  color: #333;
-  border-left: 1px dashed #eee;
-}
-td a {
-  margin-right: 40px;
-  font-size: 14px;
-}
-td.modified {
-  text-align: center;
-}
... 756 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/flask-autoindex.git



More information about the Python-modules-commits mailing list