File python-django-safeform.spec of Package python-django-safeform
# norootforbuild
Name: python-django-safeform
Version: 2.0.0
Release: 1
Summary: CSRF protection for Django forms
License: BSD License
Group: Development/Libraries/Python
Source: django-safeform-%{version}.tar.gz
URL: http://github.com/simonw/django-safeform
BuildRequires: python-devel, python-setuptools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: python-django
%{py_requires}
%description
CSRF protection for Django implemented at the form level - no middleware required.
There are two steps to protecting a django.forms form:
- Wrap it with the SafeForm class decorator. This adds a hidden csrf_token field to
it along with validation logic for checking if that token has the correct value.
It also changes the signature of the form class slightly, see example below.
- Apply the @csrf_protect middleware to the view containing the form. This ensures
that a _csrf_cookie is correctly set.
Run "./manage.py runserver" in the examples folder to start a Django server demonstrating
the functionality of the library. Use "./manage.py test" in the same directory to run the unit tests.
Author:
--------
Simon Willison <simon+safeform@simonwillison.net>
%prep
%setup -q -n django-safeform-%{version}
%build
%{__python} setup.py build
%install
%{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot} --record-rpm=INSTALLED_FILES
%files -f INSTALLED_FILES
%defattr(-,root,root)