diff --git a/docs/check_decorator.txt b/docs/check_decorator.txt index 100f677..3461b99 100644 --- a/docs/check_decorator.txt +++ b/docs/check_decorator.txt @@ -19,10 +19,10 @@ Lets start with an example permission:: class FlatpagePermission(permissions.BasePermission): label = 'flatpage_permission' checks = ('can_do_foo',) - + def can_do_foo(self): # ... - + authority.register(Campaign, FlatpagePermission) A decorator for such a simple view would look like:: @@ -53,12 +53,12 @@ a string on the decorator:: @permission_required('flatpage_permission.can_do_foo', 'arg1', 'arg2') def my_view(required, arg1, arg2): # ... - + What happens under the hood?:: # Assumed the view gets called like this my_view(request, 'bla', 'blubb') - + # At the end, the decorator would been called like this can_do_foo('bla', 'blubb') @@ -78,9 +78,9 @@ Here is an example:: # permission.py def can_do_foo(self, flatpage_instance=None): # ... - - # views.py - from django.contrib.flatpages.models import Flatpage + + # views.py + from django.contrib.flatpages.models import Flatpage @permission_required('flatpage_permission.can_do_foo', (Flatpage, 'url__iexact', 'url)) def flatpage(required, url): # ... diff --git a/docs/check_python.txt b/docs/check_python.txt index 3dce90a..46a3858 100644 --- a/docs/check_python.txt +++ b/docs/check_python.txt @@ -4,4 +4,4 @@ Check permissions in python code ================================ -*to be written* \ No newline at end of file +*to be written* diff --git a/docs/check_templates.txt b/docs/check_templates.txt index f84566c..92ba89a 100644 --- a/docs/check_templates.txt +++ b/docs/check_templates.txt @@ -50,7 +50,7 @@ Syntax and example:: {% get_permissions obj as "my_permissions" %} {% get_permissions obj for request.user as "my_permissions" %} - + get_permission ============== @@ -66,7 +66,7 @@ Example:: {% get_permission "poll_permission.change_poll" for request.user and poll as "is_allowed" %} {% get_permission "poll_permission.change_poll" for request.user and poll,second_poll as "is_allowed" %} - + {% if is_allowed %} I've got ze power to change ze pollllllzzz. Muahahaa. {% else %} diff --git a/docs/configuration.txt b/docs/configuration.txt index 6456b71..bcf734a 100644 --- a/docs/configuration.txt +++ b/docs/configuration.txt @@ -1,5 +1,5 @@ .. _configuration: - + ============= Configuration ============= @@ -31,7 +31,7 @@ context processors:: 'django.core.context_processors.media', 'django.core.context_processors.request', ) - + urls.py ======= diff --git a/docs/create_basic_permission.txt b/docs/create_basic_permission.txt index 47a2a36..2920f8f 100644 --- a/docs/create_basic_permission.txt +++ b/docs/create_basic_permission.txt @@ -70,7 +70,7 @@ In your python code ------------------- :: - def my_view(request): + def my_view(request): check = FlatPagePermission(request.user) if check.change_flatpage(): print "Yay, you can change a flatpage!" @@ -84,9 +84,9 @@ Using the view decorator @permission_required_or_403('flatpage_permission.change_flatpage') def my_view(request): # ... - + See :ref:`check-decorator` how the decorator works in detail. - + In your templates ----------------- :: @@ -108,7 +108,7 @@ applications. See :ref:`configuration` how to set up ``autodiscover``. .. image:: .static/authority-permission-py.png :align: left - + We encourage you to place your permission classes in a file called ``permissions.py`` inside your application directories. This will not only keep your application files clean, but it will also load every permission diff --git a/docs/create_per_object_permission.txt b/docs/create_per_object_permission.txt index bdec807..bd2c0b4 100644 --- a/docs/create_per_object_permission.txt +++ b/docs/create_per_object_permission.txt @@ -9,7 +9,7 @@ permission*. A description would be:: Attach a to an object Attach a to an user - + If the user has and the object has then do-something, otherwise do-something-else. @@ -39,7 +39,7 @@ Create per-object permissions Creating per-object permissions is super simple. See this piece of permission class code:: - + class FlatPagePermission(BasePermission): label = 'flatpage_permission' checks = ('review',) @@ -85,7 +85,7 @@ In your python code :: from myapp.permissions import FlatPagePermission - def my_view(request): + def my_view(request): check = FlatPagePermission(request.user) flatpage_object = Flatpage.objects.get(url='/homepage/') if check.review_flatpage(flatpage_object): @@ -102,9 +102,9 @@ Using the view decorator (Flatpage, 'url__iexact', 'url')) # The flatpage_object def my_view(request, url): # ... - + See :ref:`check-decorator` how the decorator works in detail. - + In your templates ----------------- :: diff --git a/docs/documentation_guidelines.txt b/docs/documentation_guidelines.txt index 13b76dd..fc8d6db 100644 --- a/docs/documentation_guidelines.txt +++ b/docs/documentation_guidelines.txt @@ -13,13 +13,13 @@ Headline scheme =================================== First level (equals top and bottom) =================================== - + Second Level (equals bottom) ============================ - + Third level (dashes botton) --------------------------- - + Fourth level (drunken dashes bottom) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -31,10 +31,10 @@ Overall salutation guidelines Use the *We* and *you*:: We think that you should send us a bottle of your local beer. - + Some thoughts ============= * Many internal links are good * Text should not be wider than 80 characters -* Two pages are better than one ultra-long page \ No newline at end of file +* Two pages are better than one ultra-long page diff --git a/docs/handling_python.txt b/docs/handling_python.txt index 023a9b1..33ea6be 100644 --- a/docs/handling_python.txt +++ b/docs/handling_python.txt @@ -4,4 +4,4 @@ Handling permissions in python code =================================== -*to be written* \ No newline at end of file +*to be written* diff --git a/docs/handling_template.txt b/docs/handling_template.txt index ab9b718..8f5e0d8 100644 --- a/docs/handling_template.txt +++ b/docs/handling_template.txt @@ -4,4 +4,4 @@ Handling permissions using templates ==================================== -*to be written* \ No newline at end of file +*to be written* diff --git a/docs/index.txt b/docs/index.txt index a632664..6f9fda9 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -37,15 +37,15 @@ Documentation .. toctree:: :maxdepth: 1 - + installation configuration **Create and check permissions:** - + .. toctree:: :maxdepth: 1 - + create_basic_permission create_per_object_permission create_custom_permission @@ -54,7 +54,7 @@ Documentation .. toctree:: :maxdepth: 2 - + check_python check_decorator check_templates @@ -63,21 +63,21 @@ Documentation .. toctree:: :maxdepth: 1 - + handling_python handling_admin handling_template Other pages =========== - + * :ref:`search` * :ref:`genindex` .. toctree:: :maxdepth: 1 :glob: - + tips_tricks support documentation_guidelines diff --git a/docs/installation.txt b/docs/installation.txt index 9ccbafb..c85fc38 100644 --- a/docs/installation.txt +++ b/docs/installation.txt @@ -15,9 +15,9 @@ The latest, stable version is always available via the `Python package index_` would prefer either ``pip`` or ``easy_install``:: pip install django-authority - + # .. or with easy_install: - + easy_install django-authority .. _the site: http://pypi.python.org/pypi/django-authority/