Skip to main content

what is it?

decoupage is a dynamic file server that allows for index pages configurable with genshi templates and .ini files. I mainly wrote it because i was tired of using apache for serving my website and generating index.html files by hand. Decoupage provides views into the filesystem.

how do i use it?

Set up a paste .ini file that specifies the directory to serve (decoupage.directory) and, optionally, a configuration file .ini file (decoupage.configuraton) which specifies the labels for the files based on directory. An example of a paste .ini file is in decoupage.ini. Note the [app:decoupage] section:

[app:decoupage]
paste.app_factory = decoupage.factory:factory
decoupage.directory = %(here)s/example
decoupage.configuration = %(here)s/example.ini

The labels for files are in example.ini, specified by sections as directories:

[/]
foo.txt = a file about cats

[/cats]
lilly.txt = lilly
hobbes.txt = a file about Hobbes

You can specify the entire layout from here. Alternately, you can have an index.ini in a directory which, if present, overrides the default configuration. Such a file is in the fleem subdirectory of example:

/template = index.html
fleem.txt = some fleem for ya

Try it out! Install decoupage and run paster serve decoupage.ini and point your browser to the URL it gives you.

how do i do more with decoupage?

Since filenames can’t start with a / (just try it!), the functionality of decoupage may be extended with / commands in a section. This is done by adding a setuptools entry_point to [decoupage.formatters]. See the decoupage setup.py and decoupage.formatters for examples. For instance,

Running decoupage-formatters from the command line gives the list of formatters that are available (which are pluggable setuptools extension points at [decoupage.formatters]). For example: /include = site.html could include the site.html genshi template at the top of the body.

Formatters:

sort:

determines how to sort the files in a directory; right now only by case-insensitive alphabetically * reverse : reverse the order of the sorting

all:

only pass files of a certain pattern; the inverse of ignore calling all with no arguments means only files with descriptions are used

title:

splits a description into a title and a description via a separator in the description. The template will now have an additional variable, ‘title’, per file Arguments: * separator: what separator to use (‘:’ by default)

describe:

obtain the description from the filename the file extension (if any) will be dropped and spaces will be substituted for underscores

ignore:

ignore files of a glob patterns. These files will not be linked to in the template. e.g. /ignore = .* *.pdf # don't list dotfiles and PDFs

include: include a file at the top of the body

css: specify CSS used (whitespace separated list)

Decoupage also makes use of other special intrinsic keywords:

formatters: ordered list of formatters to apply

inherit: inherit configuration from a certain directory (instead of the parent

transform: a list of transformers for contenttransformer

Testing

Right now, there is minimal testing.

TODO

  • allow transformers to be configurable on a per-directory basis

  • add a ?format=rss query string argument

  • add a ?template=foo.html query string argument

Release files for decoupage 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for decoupage 0.16.0
File Size Uploaded
decoupage-0.16.0.tar.gz 14.8 kB Details

Release files / decoupage-0.16.0.tar.gz

Download URL decoupage-0.16.0.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
60193bcffa3c0393ea7f8f1d782ceaf2859ab1c47e3d4fa4047a0f6cfc3e3a19
BLAKE2b-256 checksum
How to use checksums
cce51ae5bce4916a65f27c5a8450e6ed79df3c4d10012892a3d29cc4f370fb75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Release history Release notifications | RSS feed

This release

0.16.0 This release

1 release file

0.15.1

1 release file

0.15

1 release file

0.14.2

1 release file

0.14.1

1 release file

0.14.0

1 release file

0.13.3

1 release file

0.13.2

1 release file

0.13.1

1 release file

0.13.0

1 release file

0.12.2

1 release file

0.12.1

1 release file

0.12

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.11

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

2 release files

0.3.3

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page