Removing trailing whitespace.

This commit is contained in:
Randall Degges 2011-02-21 09:04:31 -08:00
parent 5ce50c0341
commit 3f3f06dda0
11 changed files with 37 additions and 37 deletions

View file

@ -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):
# ...

View file

@ -4,4 +4,4 @@
Check permissions in python code
================================
*to be written*
*to be written*

View file

@ -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 %}

View file

@ -1,5 +1,5 @@
.. _configuration:
=============
Configuration
=============
@ -31,7 +31,7 @@ context processors::
'django.core.context_processors.media',
'django.core.context_processors.request',
)
urls.py
=======

View file

@ -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

View file

@ -9,7 +9,7 @@ permission*. A description would be::
Attach a <codename> to an object
Attach a <codename> to an user
If the user has <codename> and the object has <codename> 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
-----------------
::

View file

@ -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
* Two pages are better than one ultra-long page

View file

@ -4,4 +4,4 @@
Handling permissions in python code
===================================
*to be written*
*to be written*

View file

@ -4,4 +4,4 @@
Handling permissions using templates
====================================
*to be written*
*to be written*

View file

@ -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

View file

@ -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/