diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..774e076 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: python +sudo: false +python: + - "2.6" + - "2.7" + +env: + - DJANGO="Django==1.4.22" + - DJANGO="Django==1.7.10" + - DJANGO="Django==1.8.4" + +matrix: + exclude: + - python: "2.6" + env: DJANGO="Django==1.8.4" + - python: "2.6" + env: DJANGO="Django==1.7.10" + +install: pip install $DJANGO + +script: ./runtests.sh diff --git a/README.rst b/README.rst index beef668..fd3fb3a 100644 --- a/README.rst +++ b/README.rst @@ -52,9 +52,10 @@ applied before your views are imported. Differences from Django ----------------------- -``django-session-csrf`` does not assign CSRF tokens to anonymous users because -we don't want to support a session for every anonymous user. Instead, views -that need anonymous forms can be decorated with ``@anonymous_csrf``:: +By default ``django-session-csrf`` does not assign CSRF tokens to anonymous +users because we don't want to support a session for every anonymous user. +Instead, views that need anonymous forms can be decorated with +``@anonymous_csrf``:: from session_csrf import anonymous_csrf @@ -105,6 +106,18 @@ the following setting: Default: False +Alternatively, you can make ``django-session-csrf`` act exactly as Django does +with the following setting: + + ``ANON_AS_LOGGED_IN`` + set the CSRF token for anonymous users in their session + + Default: ``False`` + +If ``ANON_AS_LOGGEDIN`` is set, the ``anonymous_csrf`` and +``anonymous_csrf_exempt`` will do nothing to the view they decorate and issue a +warning. + Why do I want this? ------------------- diff --git a/runtests.sh b/runtests.sh index 663ce0f..5ea052a 100755 --- a/runtests.sh +++ b/runtests.sh @@ -6,7 +6,7 @@ cat > $SETTINGS <