Flask-AutoIndex-0.6.2/ 0000775 0001756 0001756 00000000000 13343772240 014104 5 ustar sub sub 0000000 0000000 Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/ 0000775 0001756 0001756 00000000000 13343772240 020616 5 ustar sub sub 0000000 0000000 Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/PKG-INFO 0000664 0001756 0001756 00000002454 13343772240 021720 0 ustar sub sub 0000000 0000000 Metadata-Version: 1.1
Name: Flask-AutoIndex
Version: 0.6.2
Summary: The mod_autoindex for Flask
Home-page: http://pythonhosted.org/Flask-AutoIndex
Author: Heungsub Lee
Author-email: sub@subl.ee
License: BSD
Description-Content-Type: UNKNOWN
Description:
Flask-AutoIndex
---------------
Flask-AutoIndex generates an index page for your `Flask`_ application
automatically. The result just like `mod_autoindex`_, but the look is more
awesome! Look at this:
.. _Flask: http://flask.pocoo.org/
.. _mod_autoindex: http://httpd.apache.org/docs/current/mod/mod_autoindex.html
Links
`````
* `documentation `_
* `development version
`_
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/entry_points.txt 0000664 0001756 0001756 00000000065 13343772240 024115 0 ustar sub sub 0000000 0000000 [console_scripts]
fai = flask_autoindex.run:app.run
Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/dependency_links.txt 0000664 0001756 0001756 00000000001 13343772240 024664 0 ustar sub sub 0000000 0000000
Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/top_level.txt 0000664 0001756 0001756 00000000020 13343772240 023340 0 ustar sub sub 0000000 0000000 flask_autoindex
Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/requires.txt 0000664 0001756 0001756 00000000052 13343772240 023213 0 ustar sub sub 0000000 0000000 Flask>=0.8
Flask-Silk>=0.2
future>=0.13.0
Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/SOURCES.txt 0000664 0001756 0001756 00000005656 13343772240 022516 0 ustar sub sub 0000000 0000000 LICENSE
MANIFEST.in
README
setup.cfg
setup.py
Flask_AutoIndex.egg-info/PKG-INFO
Flask_AutoIndex.egg-info/SOURCES.txt
Flask_AutoIndex.egg-info/dependency_links.txt
Flask_AutoIndex.egg-info/entry_points.txt
Flask_AutoIndex.egg-info/not-zip-safe
Flask_AutoIndex.egg-info/requires.txt
Flask_AutoIndex.egg-info/top_level.txt
docs/conf.py
docs/index.rst
docs/_static/example.png
docs/_static/flask-autoindex.png
flask_autoindex/__init__.py
flask_autoindex/entry.py
flask_autoindex/icons.py
flask_autoindex/run.py
flask_autoindex/static/asc.gif
flask_autoindex/static/autoindex.css
flask_autoindex/static/desc.gif
flask_autoindex/templates/__autoindex__/autoindex.html
flask_autoindex/templates/__autoindex__/macros.html
tests/__init__.py
tests/blueprinttest/__init__.py
tests/static/helloworld.txt
tests/static/test.7z
tests/static/test.ai
tests/static/test.alz
tests/static/test.app
tests/static/test.applescript
tests/static/test.asp
tests/static/test.avi
tests/static/test.bak
tests/static/test.bat
tests/static/test.bin
tests/static/test.bmp
tests/static/test.bup
tests/static/test.c
tests/static/test.cab
tests/static/test.cer
tests/static/test.cfg
tests/static/test.cgi
tests/static/test.com
tests/static/test.conf
tests/static/test.cpl
tests/static/test.cpp
tests/static/test.css
tests/static/test.csv
tests/static/test.cur
tests/static/test.db
tests/static/test.dll
tests/static/test.dmg
tests/static/test.doc
tests/static/test.docx
tests/static/test.eps
tests/static/test.exe
tests/static/test.fla
tests/static/test.flv
tests/static/test.gif
tests/static/test.h
tests/static/test.htm
tests/static/test.html
tests/static/test.hwp
tests/static/test.ico
tests/static/test.ics
tests/static/test.ini
tests/static/test.iso
tests/static/test.jar
tests/static/test.java
tests/static/test.jpeg
tests/static/test.jpg
tests/static/test.js
tests/static/test.json
tests/static/test.jsp
tests/static/test.less
tests/static/test.log
tests/static/test.markdown
tests/static/test.md
tests/static/test.mid
tests/static/test.mov
tests/static/test.mp3
tests/static/test.mp4
tests/static/test.mpa
tests/static/test.mpeg
tests/static/test.mpg
tests/static/test.pdf
tests/static/test.php
tests/static/test.pkg
tests/static/test.png
tests/static/test.ppt
tests/static/test.pptx
tests/static/test.psd
tests/static/test.py
tests/static/test.rar
tests/static/test.rb
tests/static/test.rss
tests/static/test.rtf
tests/static/test.sh
tests/static/test.smi
tests/static/test.sql
tests/static/test.svg
tests/static/test.swf
tests/static/test.sys
tests/static/test.tar
tests/static/test.tar.gz
tests/static/test.tgz
tests/static/test.tif
tests/static/test.tmp
tests/static/test.toast
tests/static/test.torrent
tests/static/test.ttf
tests/static/test.txt
tests/static/test.vb
tests/static/test.vcd
tests/static/test.vcf
tests/static/test.wav
tests/static/test.wmv
tests/static/test.xhtml
tests/static/test.xls
tests/static/test.xlsx
tests/static/test.xml
tests/static/test.xsl
tests/static/test.yml
tests/static/test.zip Flask-AutoIndex-0.6.2/Flask_AutoIndex.egg-info/not-zip-safe 0000664 0001756 0001756 00000000001 13317674102 023043 0 ustar sub sub 0000000 0000000
Flask-AutoIndex-0.6.2/PKG-INFO 0000664 0001756 0001756 00000002454 13343772240 015206 0 ustar sub sub 0000000 0000000 Metadata-Version: 1.1
Name: Flask-AutoIndex
Version: 0.6.2
Summary: The mod_autoindex for Flask
Home-page: http://pythonhosted.org/Flask-AutoIndex
Author: Heungsub Lee
Author-email: sub@subl.ee
License: BSD
Description-Content-Type: UNKNOWN
Description:
Flask-AutoIndex
---------------
Flask-AutoIndex generates an index page for your `Flask`_ application
automatically. The result just like `mod_autoindex`_, but the look is more
awesome! Look at this:
.. _Flask: http://flask.pocoo.org/
.. _mod_autoindex: http://httpd.apache.org/docs/current/mod/mod_autoindex.html
Links
`````
* `documentation `_
* `development version
`_
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Flask-AutoIndex-0.6.2/LICENSE 0000664 0001756 0001756 00000002664 13317673730 015126 0 ustar sub sub 0000000 0000000 Copyright (c) 2010-2013 by Heungsub Lee.
Some rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Flask-AutoIndex-0.6.2/setup.py 0000664 0001756 0001756 00000003374 13343772207 015630 0 ustar sub sub 0000000 0000000 """
Flask-AutoIndex
---------------
Flask-AutoIndex generates an index page for your `Flask`_ application
automatically. The result just like `mod_autoindex`_, but the look is more
awesome! Look at this:
.. _Flask: http://flask.pocoo.org/
.. _mod_autoindex: http://httpd.apache.org/docs/current/mod/mod_autoindex.html
Links
`````
* `documentation `_
* `development version
`_
"""
import re
from setuptools import setup
def run_tests():
from tests import suite
return suite()
setup(
name='Flask-AutoIndex',
version='0.6.2',
license='BSD',
author='Heungsub Lee',
author_email=re.sub('((sub).)(.*)', r'\2@\1.\3', 'sublee'),
url='http://pythonhosted.org/Flask-AutoIndex',
description='The mod_autoindex for Flask',
long_description=__doc__,
packages=['flask_autoindex'],
include_package_data=True,
package_data={'flask_autoindex': ['static/*',
'templates/__autoindex__/*']},
zip_safe=False,
platforms='any',
install_requires=['Flask>=0.8', 'Flask-Silk>=0.2', 'future>=0.13.0'],
test_suite='__main__.run_tests',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
],
entry_points={
'console_scripts': [
'fai = flask_autoindex.run:app.run',
],
},
)
Flask-AutoIndex-0.6.2/docs/ 0000775 0001756 0001756 00000000000 13343772240 015034 5 ustar sub sub 0000000 0000000 Flask-AutoIndex-0.6.2/docs/conf.py 0000664 0001756 0001756 00000016123 13317673730 016343 0 ustar sub sub 0000000 0000000 # -*- coding: utf-8 -*-
#
# Flask-AutoIndex documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 31 00:34:54 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath('_themes'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Flask-AutoIndex'
copyright = u'2010-2013, Heungsub Lee'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.2.0'
# The full version, including alpha/beta/rc tags.
release = '0.2.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
#pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'flask_small'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
'index_logo': 'flask-autoindex.png',
'github_fork': 'sublee/flask-autoindex'
}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['_themes']
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = 'favicon.ico'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'Flask-AutoIndexdoc'
# -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Flask-AutoIndex.tex', u'Flask-AutoIndex Documentation',
u'Heungsub Lee', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'flask-autoindex', u'Flask-AutoIndex Documentation',
[u'Heungsub Lee'], 1)
]
Flask-AutoIndex-0.6.2/docs/index.rst 0000664 0001756 0001756 00000014026 13317673730 016705 0 ustar sub sub 0000000 0000000 Flask-AutoIndex
~~~~~~~~~~~~~~~
.. module:: flask_autoindex
Flask-AutoIndex generates an index page for your `Flask`_ application
automatically. The result just like `mod_autoindex`_, but the look is more
awesome! Look at this:
.. figure:: _static/example.png
:alt: The screenshot of index page generated by Flask-AutoIndex
This module contains pre-designed template and css file. It is default
style, but you can make your own style.
.. note::
Flask-AutoIndex uses `Flask-Silk`_ to serve icons. Per default, the icons
from Mark James's `Silk`_ icon set are used. These icons are licensed
under `Creative Commons Attribution 2.5 License `_ or
`3.0 License `_. Before using the icons, read the license.
.. _Flask: http://flask.pocoo.org/
.. _mod_autoindex: http://httpd.apache.org/docs/current/mod/mod_autoindex.html
.. _Flask-Silk: http://packages.python.org/Flask-Silk
.. _Silk: http://www.famfamfam.com/lab/icons/silk/
.. _CC-BY-2.5: http://creativecommons.org/licenses/by/2.5
.. _CC-BY-3.0: http://creativecommons.org/licenses/by/3.0
Installation
============
Install Flask-AutoIndex with ``easy_install`` or ``pip`` command::
$ easy_install Flask-AutoIndex
::
$ pip install Flask-AutoIndex
or check out development version::
$ git clone git://github.com/sublee/flask-autoindex.git
How to Use
==========
Flask-AutoIndex is easy and extensible. It supports flask application.
We will make the application in flask application. There is a basic usage::
import os.path
from flask import Flask
from flask_autoindex import AutoIndex
app = Flask(__name__)
AutoIndex(app, browse_root=os.path.curdir)
if __name__ == '__main__':
app.run()
After running the application, ``http://localhost/`` serves a generated index
page which contains the file and directory list in current directory.
Or, use a shipped console script. Just type ``fai`` in command line.
(yes, ``fai`` is an acronym of Flask-AutoIndex)::
$ fai
* Running on http://127.0.0.1:5000/
Customizing
===========
Routing a specified URL
```````````````````````
Just like a normal flask application or module. Follow the below example::
@app.route('/helloworld')
def helloworld():
return 'Hello, world!', 200
``http://localhost/helloworld`` will serve ``Hello, world!`` not
``/helloworld`` directory.
Adding an icon rule
```````````````````
If you want to present ``*.feed`` files with ``rss.png`` icon and present
a directory named ``picture`` with ``folder_picture.png`` icon, follow the
below example::
idx.add_icon_rule('rss.png', ext='feed')
idx.add_icon_rule('folder_picture.png', dirname='pictures')
You can change the root directory's icon to your own icon::
idx.add_icon_rule('http://example.org/favicon.ico', cls=RootDirectory)
Also you can add the more complex rule with a function::
import re
def is_flaskext(ent):
return isinstance(ent, Directory) and re.match('[Ff]lask-', ent.name)
idx.add_icon_rule('http://example.org/flask-extenstion.png', is_flaskext)
Here is a nice example for changing directory's icon to its ``favicon.ico``
file if it exists::
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)
.. seealso:: :meth:`AutoIndex.add_icon_rule`
Changing Silk's path
````````````````````
:class:`AutoIndex` has ``**silk_options`` keyword arguments for :class:`Silk`.
If you want to use the another path for serving silk icons, use ``silk_path``
keyword argument::
idx = AutoIndex(app, silk_path='/myicons')
Now you can get a silk icon from ``http://localhost/myicons/folder.png`` not
``http://localhost/__icons__/folder.png``.
.. seealso::
The documentation for `Flask-Silk`_
Redesigning the template
````````````````````````
:meth:`AutoIndex.render_autoindex` finds the template from the application's
template directory first. When you made the ``autoindex.html`` to the
application's template directory, :meth:`AutoIndex.render_autoindex` renders
your template::
- myapplication
- templates
- autoindex.html
- __init__.py
- views.py
Your templates could extend the default Flask-AutoIndex's template, it named
``__autoindex__/autoindex.html``. Here is a basic example:
.. sourcecode:: jinja
{% extends '__autoindex__/autoindex.html' %}
{% block meta %}
{{ super() }}
{% endblock %}
{% block header %}
My Application
{% endblock %}
{% block footer %}
{% endblock %}
To get extra fields through to your template, pass them in the
``template_context`` keyword argument::
AutoIndex(app, template_context = dict(SITENAME = 'My cool site'))
API
===
Configuration
`````````````
.. autoclass:: AutoIndex
:members:
Models
``````
.. autoclass:: Entry
:members:
.. autoclass:: File
:members:
.. autoclass:: Directory
:members:
.. autoclass:: RootDirectory
:members:
Template
````````
Blocks
------
`meta`
The innerHTML of ````.
`header`
The top of ````.
`table`
The table for the entry list.
`footer`
The bottom of ````.
Variables
---------
`curdir`
The current directory object.
`entries`
The child entry list of ``curdir``.
`sort_by`
The sorting key.
`order`
Ascending order(``1``) or Descending order(``-1``).
`endpoint`
The endpoint which renders a generated page.
Licensing and Author
====================
This project is licensed under BSD_. See LICENSE_ for the details.
I'm `Heungsub Lee`_. Any regarding questions or patches are welcomed.
.. _BSD: http://en.wikipedia.org/wiki/BSD_licenses
.. _LICENSE: https://github.com/sublee/flask-autoindex/blob/master/LICENSE
.. _Heungsub Lee: http://subl.ee/
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Flask-AutoIndex-0.6.2/docs/_static/ 0000775 0001756 0001756 00000000000 13343772240 016462 5 ustar sub sub 0000000 0000000 Flask-AutoIndex-0.6.2/docs/_static/flask-autoindex.png 0000664 0001756 0001756 00000032335 13317673730 022301 0 ustar sub sub 0000000 0000000 PNG
IHDR X d ZAN# tEXtSoftware Adobe ImageReadyqe<