This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

PyRoutes.JS provide a Javascript routes generation function like Python Routes Mapper.generate method.

Introduction

  • Do you use Python Routes library in Pylons or other applications ?
  • Do you use something like ${h.url('entry_view', entry_id=2)} in your templates ?

So, now do you dream to have Javascript routes generation function ?

PyRoutes.JS is the tool that you need !

If you have this Routes Mapper configuration :

...
map = Mapper()
...
map.connect('entry_view', '/entries/{issue_id:\d*}/', controller='issues', action='view')
map.connect('entry_edit', '/entries/{issue_id:\d*}/edit', controller='issues', action='edit')
...

In your javascript files, you can use PyRoutes.JS like this :

pyroutes.generate('entry_view', entry_id=2); // return '/entries/1/'
pyroutes.generate('entry_edit', entry_id=5); // return '/entries/5/edit/'

Installation

$ pip install pyroutes.js

Pylons integration

In my_app/config/middleware.py file, append :

...
from pylons.middleware import ErrorHandler, StatusCodeRedirect
from pylons.wsgiapp import PylonsApp
from routes.middleware import RoutesMiddleware

...

from pyroutesjs import Middleware as PyRoutesJSMiddleware       # <= append this line

...

from my_app.config.environment import load_environment

...

def make_app(global_conf, full_stack=True, static_files=True, **app_conf):

    ...

    # Append PyRoutes.js middleware
    app = PyRoutesJSMiddleware(app, config['routes.map'])      # <= append this line

    app.config = config
    return app

In your template, append :

<script type="text/javascript" src="${h.url('/js/pyroutes.js')}"></script>

Limitations

  • Currently you can only generate named routes

Source code

Mercurial repository is here : https://bitbucket.org/harobed/pyroutes.js/src

You can clone the code :

$ hg clone http://bitbucket.org/harobed/pyroutes.js

Issue tracker

You can report your bugs here : https://bitbucket.org/harobed/pyroutes.js/issues

News

0.1.0 (not released)

  • Initial version
Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0dev1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyroutes.js-0.1.0.tar.gz (4.8 kB) Copy SHA256 Checksum SHA256 Source Jun 4, 2011

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