Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Flatpages based on files with yaml syntax

Project Description

Install

pip install yamlpage

Usage

>>> import os
>>> from yamlpage import YamlPage
>>> p = YamlPage('./content')

Put page

>>> url = '/my/url'
>>> p.put(url, (
...     ('title', 'foo'),
...     ('body', 'foo\nbar'),
... ))
>>> path = './content/^my^url.yaml'
>>> content = open(path).read()
>>> print(content)
title: foo
body: |-
    foo
    bar
<BLANKLINE>

Get page

>>> p.get(url) == {'body': 'foo\nbar', 'title': 'foo'}
True
>>> p.get('/not/found/') is None
True

Check if page exists

>>> p.exists(url)
True
>>> p.exists('/not/found/')
False

Built in backends

SingleFolderBackend (default) maps ‘my/url’ to filename ‘my^url.yaml’

>>> p = YamlPage('./content')
>>> p.put('single/folder/backend', 'data')
>>> os.path.exists('./content/single^folder^backend.yaml')
True

MultiFolderBackend maps ‘my/url’ to filename ‘my/url.yaml’

>>> p = YamlPage('./content', backend='MultiFolderBackend')
>>> p.put('multi/folder/backend', 'data')
>>> os.path.exists('./content/multi/folder/backend.yaml')
True
Release History

Release History

This version
History Node

3.1.1

History Node

3.1.0

History Node

3.0.0

History Node

2.1.0

History Node

2.0.1

History Node

2.0.0

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.1.1

History Node

0.1.0

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
yamlpage-3.1.1.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Aug 7, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting