Source

pysi /

Filename Size Date modified Message
pysi
57 B
18 B
1.0 KB
1.9 KB

PySi

Installation

$ pip install pysi

Hello world

import pysi

@pysi.view('/')
def home(rq):
    return 'Hello world!'

if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    make_server('', 8000, pysi.App()).serve_forever()

Another example

from pysi import cfg, view, redirect, abort
from models import Profile
from forms import ProfileForm

@view('/profile/<int:id>/edit/', 'profile/edit.html')
def edit(rq, id):
    obj = Profile.get(id)
    if not obj or obj.user != rq.user:
        abort(404)
    form = ProfileForm(rq.form)
    if rq.method == 'POST' and form.validate():
        form.populate_obj(obj)
        obj.save()
        rq.flash('Profile updated', 'success')
        return redirect('profile.edit')
    return {'form': form, 'post': post}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.