Commits

imbolc  committed 299f3d9

fix

  • Participants
  • Parent commits c7c53f6

Comments (0)

Files changed (3)

File README.md

-PySi
-====
-
-Links
------
-
-- repository: <https://bitbucket.org/imbolc/pysi/overview>
-- russian docs: <http://pysi.org/my-modules/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, basic_auth
-	from models import Post
-	from forms import CommentForm
-
-    @view('/post/<int:id>/', 'blog/post_details.html')
-    def post_details(rq, id):
-        post = Post.get(id)
-        if not post:
-            abort(404)
-        form = CommentForm(rq.form)
-        if rq.method == 'POST' and form.validate():
-            post = Post()
-			form.populate_obj(post)
-            post.save()
-            rq.flash('Comment added', 'success')
-            return redirect(rq.full_path)
-        return {'form': form, 'post': post}
-	
+PySi
+====
+
+Links
+-----
+
+- repository: https://bitbucket.org/imbolc/pysi/
+- russian docs: http://pysi.org/my-modules/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}
+
 import os
 from setuptools import setup
 
+VERSION = '0.8.0'
 PACKAGE = 'pysi'
-VERSION = '0.8.0'
 
 if __name__ == '__main__':
     # Compile the list of packages available, because distutils doesn't have
         author = 'Imbolc',
         author_email = 'imbolc@imbolc.name',
         url = 'http://bitbucket.org/imbolc/pysi/',
-        long_description = open(
-            os.path.join(os.path.dirname(__file__), 'README.md')).read(),
+        long_description = open('README.rst').read(),
         name = PACKAGE,
         packages = packages,
         package_data = {'pysi': data_files},