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

WSGI middleware that does Rails style PUT and DELETE request emulation.

The middleware intercepts the wrapped application’s response and looks for forms with method="PUT" or method="DELETE". For each such form it replaces the value of method with “POST” and adds a hidden input field _method that contains the original request method. It also intercepts incoming requests and does the inverse transformation.

What this all means is that you can use PUT and DELETE forms in your HTML code, without having to worry about browser support for these request methods.

Install

You can install EmulateRest from PyPI:

easy_install emulaterest

or you can install the latest version from the github repository:

git clone git://github.com/abiczo/emulaterest.git
cd emulaterest
python setup.py install

Notes

  • For text/html documents the default behavior is to inject HTML style <input> elements. You can tell EmulateRest to inject XHTML style <input/> elements either by using the force_xhtml option or by serving your documents as application/xhtml+xml.
  • If you are using a gzipping middleware or any other middleware that modifies the content-encoding, make sure that EmulateRest is wrapped in that middleware and not the other way round.

Example

A complete working example using web.py:

import web

urls = ('/', 'index')

class index:
    def GET(self):
        web.ctx['headers'].append(('Content-Type', 'text/html'))
        return """<html><head><title>PUT test</title></head><body><div>
            <form method="PUT" action="/">
                <div>
                    <input type="text" name="inp" value="value">
                    <input type="submit" value="Submit">
                </div>
            </form>
            </div></body></html>
            """

    def PUT(self):
        return 'PUT ' + str(web.input())

if __name__ == '__main__':
    import emulaterest
    app = web.application(urls, globals())
    app.run(emulaterest.EmulateRestMiddleware)
Release History

Release History

0.2

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

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
emulaterest-0.2.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Apr 27, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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