Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install flask-yamlconfig

How to install Flask-YAMLConfig

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install flask-yamlconfig
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.0.3 Available View build log
Windows (64-bit)
0.0.3 Available View build log
Mac OS X (10.5+)
0.0.3 Available View build log
Linux (32-bit)
0.0.3 Available View build log
Linux (64-bit)
0.0.3 Available View build log
Web
 
Links
License
MIT
Lastest release
version 0.0.3 on Jan 28th, 2011

Flask-YAMLConfig

Usage

:: from flaskext.yamlconfig import AppYAMLConfig AppYAMLConfig(app, "main.yaml")

or

:: from flaskext.yamlconfig import install_yaml_config from flaskext.yamlconfig import AppYAMLConfig

class MyConfig(AppYAMLConfigure): def configure_mysection(self, content): for item in content: ....

yaml_config = install_yaml_config(app, MyConfig) yaml_config("main.yaml")

Register a renderers

:: from flask import current_app from flaskext.yamlconfig Renderer from werkzeug.wrappers import BaseResponse

class JsonRenderer(Renderer): def render(self, view_result): return current_app.response_class(json.dumps(view_result, indent=None if request.is_xhr else 2), mimetype='application/json')

register_renderer('json', JsonRenderer)

Config file sample

System Message: WARNING/2 (<string>, line 46)

Literal block expected; none found.

index: view: views.index.index url: - / - /page/<int:page> renderer: actions/index/index.html

blog_edit: view: views.blog.edit_blog url: /blog/edit/<blog_url> renderer: actions/blog/edit.html methods: - GET - POST context: w_group: empty

ajaxBlogJoin: view: views.blog.ajax_blog_join url: /ajax/blogjoin/<int:blog_id> methods: - POST renderer: json

View example

def index(context, request, page=1): '''Main page ''' return dict(pages = Pager(Topic.all(), page))

Subscribe to package updates

Last updated Jan 28th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.