[Python-modules-commits] [django-guardian] 01/06: Import django-guardian_1.4.3.orig.tar.gz
Brian May
bam at moszumanska.debian.org
Sun Apr 3 01:55:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch master
in repository django-guardian.
commit 1bd34f4d6d85b6e90fff6806a66740626d83ee70
Author: Brian May <bam at debian.org>
Date: Sun Apr 3 11:49:19 2016 +1000
Import django-guardian_1.4.3.orig.tar.gz
---
.gitignore | 2 +
.travis.yml | 72 ++--
CHANGES | 36 +-
MANIFEST.in | 31 +-
PKG-INFO | 4 +-
README.rst | 4 -
VERSION.txt | 1 -
benchmarks/__init__.py | 0
benchmarks/models.py | 19 +
benchmarks/run_benchmarks.py | 190 ++++++++++
benchmarks/settings.py | 30 ++
django_guardian.egg-info/PKG-INFO | 4 +-
django_guardian.egg-info/SOURCES.txt | 65 ++--
docs/__pycache__/exts.cpython-33.pyc | Bin 952 -> 0 bytes
docs/__pycache__/exts.cpython-34.pyc | Bin 791 -> 0 bytes
docs/__pycache__/exts.cpython-35.pyc | Bin 791 -> 0 bytes
docs/api/guardian.shortcuts.rst | 16 +
docs/conf.py | 40 +--
docs/configuration.rst | 34 +-
docs/develop/testing.rst | 4 +-
docs/exts.py | 49 ++-
docs/exts.pyc | Bin 922 -> 0 bytes
docs/index.rst | 4 +-
docs/theme/rtd_theme/breadcrumbs.html | 11 -
docs/theme/rtd_theme/footer.html | 16 -
docs/theme/rtd_theme/layout.html | 137 -------
docs/theme/rtd_theme/layout_old.html | 205 -----------
docs/theme/rtd_theme/sass/_badge.sass | 84 -----
.../rtd_theme/sass/_badge_font_awesome_mini.sass | 53 ---
docs/theme/rtd_theme/sass/_breadcrumbs.sass | 25 --
docs/theme/rtd_theme/sass/_nav.sass | 260 --------------
docs/theme/rtd_theme/sass/badge_only.sass | 9 -
docs/theme/rtd_theme/sass/config.rb | 38 --
docs/theme/rtd_theme/sass/theme.sass | 57 ---
docs/theme/rtd_theme/search.html | 50 ---
docs/theme/rtd_theme/searchbox.html | 5 -
docs/theme/rtd_theme/static/badge_only.css | 1 -
.../rtd_theme/static/font/fontawesome_webfont.eot | Bin 37405 -> 0 bytes
.../rtd_theme/static/font/fontawesome_webfont.svg | 399 ---------------------
.../rtd_theme/static/font/fontawesome_webfont.ttf | Bin 79076 -> 0 bytes
.../rtd_theme/static/font/fontawesome_webfont.woff | Bin 43572 -> 0 bytes
docs/theme/rtd_theme/static/theme.css | 1 -
docs/theme/rtd_theme/static/theme.js | 16 -
docs/theme/rtd_theme/theme.conf | 7 -
docs/theme/rtd_theme/versions.html | 38 --
docs/userguide/assign.rst | 4 +-
docs/userguide/check.rst | 8 +
docs/userguide/example_project.rst | 13 +-
docs/userguide/performance.rst | 30 ++
example_project/__init__.py | 0
example_project/context_processors.py | 5 +
example_project/core/__init__.py | 0
example_project/core/admin.py | 5 +
example_project/core/migrations/0001_initial.py | 57 +++
example_project/core/migrations/__init__.py | 0
example_project/core/models.py | 14 +
example_project/manage.py | 17 +
example_project/posts/__init__.py | 0
example_project/posts/admin.py | 15 +
example_project/posts/migrations/0001_initial.py | 29 ++
example_project/posts/migrations/__init__.py | 0
example_project/posts/models.py | 21 ++
.../posts/templates/posts/post_detail.html | 41 +++
.../posts/templates/posts/post_list.html | 36 ++
example_project/posts/urls.py | 8 +
example_project/posts/views.py | 29 ++
example_project/requirements.txt | 6 +
example_project/settings.py | 102 ++++++
example_project/static/css/bootstrap.min.css | 9 +
.../static/img/glyphicons-halflings-white.png | Bin 0 -> 8777 bytes
.../static/img/glyphicons-halflings.png | Bin 0 -> 12799 bytes
example_project/static/js/bootstrap.min.js | 6 +
example_project/templates/403.html | 17 +
example_project/templates/404.html | 18 +
example_project/templates/500.html | 16 +
example_project/templates/base.html | 58 +++
example_project/templates/home.html | 15 +
example_project/urls.py | 22 ++
extras.py | 14 +-
guardian/__init__.py | 21 +-
guardian/admin.py | 61 ++--
guardian/backends.py | 13 +-
guardian/checks.py | 4 -
guardian/compat.py | 36 +-
guardian/conf/__init__.py | 1 -
guardian/conf/settings.py | 20 +-
guardian/core.py | 213 ++++++++---
guardian/decorators.py | 20 +-
guardian/exceptions.py | 5 +-
guardian/forms.py | 10 +-
guardian/management/__init__.py | 11 +-
guardian/management/commands/__init__.py | 1 -
.../management/commands/clean_orphan_obj_perms.py | 9 +-
guardian/managers.py | 12 +-
guardian/migrations/0001_initial.py | 12 +-
guardian/mixins.py | 40 ++-
guardian/models.py | 11 +-
guardian/shortcuts.py | 159 +++++---
guardian/templatetags/__init__.py | 1 -
guardian/templatetags/guardian_tags.py | 9 +-
guardian/testapp/__init__.py | 1 -
.../testapp/migrations/0006_auto_20160221_1054.py | 30 ++
.../testapp/migrations/0007_auto_20160309_0245.py | 46 +++
guardian/testapp/models.py | 29 +-
guardian/testapp/tests/conf.py | 16 +-
guardian/testapp/tests/test_admin.py | 115 +++---
guardian/testapp/tests/test_checks.py | 9 +-
guardian/testapp/tests/test_conf.py | 5 +-
guardian/testapp/tests/test_core.py | 148 ++++++--
guardian/testapp/tests/test_custompkmodel.py | 10 +-
guardian/testapp/tests/test_decorators.py | 48 +--
guardian/testapp/tests/test_direct_rel.py | 62 ++--
guardian/testapp/tests/test_forms.py | 7 +-
guardian/testapp/tests/test_management.py | 25 +-
guardian/testapp/tests/test_managers.py | 3 +-
guardian/testapp/tests/test_mixins.py | 17 +-
guardian/testapp/tests/test_orphans.py | 12 +-
guardian/testapp/tests/test_other.py | 131 ++++---
guardian/testapp/tests/test_shortcuts.py | 278 +++++++++-----
guardian/testapp/tests/test_tags.py | 44 +--
guardian/testapp/tests/test_utils.py | 30 +-
guardian/testapp/testsettings.py | 22 +-
guardian/utils.py | 35 +-
guardian/version.py | 4 +
manage.py | 3 +-
pytest.ini | 2 +
requirements.txt | 1 +
setup.cfg | 3 +
setup.py | 76 ++--
tests.py | 43 ---
tox.ini | 7 +-
utils.py | 3 +-
132 files changed, 2307 insertions(+), 2259 deletions(-)
diff --git a/.gitignore b/.gitignore
index f502980..8726775 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+guardian/version.py
*.pyc
*.log
*.egg
@@ -18,6 +19,7 @@ dist
example_project/media
example_project/conf/*.py
.idea/
+.eggs/
# WebDAV remote filesystem
.DAV
diff --git a/.travis.yml b/.travis.yml
index 6bf2eb0..a8beb80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,50 +10,66 @@ env:
- DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
- DJANGO_VERSION=1.8.7 DATABASE_URL=postgres://postgres@/django_guardian
- DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
+ - DJANGO_VERSION=master DATABASE_URL=postgres://postgres@/django_guardian
+
- DJANGO_VERSION=1.7.10 DATABASE_URL=mysql://root:@localhost/django_guardian
- DJANGO_VERSION=1.8.7 DATABASE_URL=mysql://root:@localhost/django_guardian
- DJANGO_VERSION=1.9.1 DATABASE_URL=mysql://root:@localhost/django_guardian
+ - DJANGO_VERSION=master DATABASE_URL=mysql://root:@localhost/django_guardian
+
- DJANGO_VERSION=1.7.10 DATABASE_URL=sqlite://
- DJANGO_VERSION=1.8.7 DATABASE_URL=sqlite://
- DJANGO_VERSION=1.9.1 DATABASE_URL=sqlite://
+ - DJANGO_VERSION=master DATABASE_URL=sqlite://
install:
- - travis_retry pip install -q mock==1.0.1 Django==$DJANGO_VERSION coverage coveralls
+ - travis_retry pip install -q mock==1.0.1 pytest pytest-django pytest-cov django-environ setuptools_scm
+# Install django master or version
+ - bash -c "if [[ "$DJANGO_VERSION" == 'master' ]]; then pip install 'https://github.com/django/django/archive/master.tar.gz'; else pip install Django==$DJANGO_VERSION; fi; "
# Install database drivers
- bash -c "if [[ $DATABASE_URL = postgres* ]]; then pip install psycopg2==2.6.1; fi; "
- bash -c "if [[ $DATABASE_URL = mysql* ]]; then pip install mysqlclient==1.3.7; fi; "
script:
- - coverage run --source=guardian setup.py test
-
-after_success:
- - coverage report --omit "guardian/compat.py,guardian/testapp/testsettings.py" -m guardian/*.py
- - coveralls
+ - python ./setup.py --version
+ - py.test --cov=guardian
notifications:
irc: "irc.freenode.net#django-guardian"
matrix:
- exclude:
- # Drop python 3.3 and django 1.9
- - python: 3.3
- env: DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
- - python: 3.3
- env: DJANGO_VERSION=1.9.1 DATABASE_URL=mysql://root:@localhost/django_guardian
- - python: 3.3
- env: DJANGO_VERSION=1.9.1 DATABASE_URL=sqlite://
- # Drop python 3.5 and django 1.7
- - python: 3.5
- env: DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
- - python: 3.5
- env: DJANGO_VERSION=1.7.10 DATABASE_URL=mysql://root:@localhost/django_guardian
- - python: 3.5
- env: DJANGO_VERSION=1.7.10 DATABASE_URL=sqlite://
- # Drop python 3.3 with postgres due lack of driver
- - python: 3.3
- env: DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
- - python: 3.3
- env: DJANGO_VERSION=1.8.7 DATABASE_URL=postgres://postgres@/django_guardian
- - python: 3.3
- env: DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
+ fast_finish: true
+ exclude:
+ # Drop python 3.3 and django 1.9
+ - python: 3.3
+ env: DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
+ - python: 3.3
+ env: DJANGO_VERSION=1.9.1 DATABASE_URL=mysql://root:@localhost/django_guardian
+ - python: 3.3
+ env: DJANGO_VERSION=1.9.1 DATABASE_URL=sqlite://
+ # Drop python 3.3 and django master
+ - python: 3.3
+ env: DJANGO_VERSION=master DATABASE_URL=postgres://postgres@/django_guardian
+ - python: 3.3
+ env: DJANGO_VERSION=master DATABASE_URL=mysql://root:@localhost/django_guardian
+ - python: 3.3
+ env: DJANGO_VERSION=master DATABASE_URL=sqlite://
+ # Drop python 3.5 and django 1.7
+ - python: 3.5
+ env: DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
+ - python: 3.5
+ env: DJANGO_VERSION=1.7.10 DATABASE_URL=mysql://root:@localhost/django_guardian
+ - python: 3.5
+ env: DJANGO_VERSION=1.7.10 DATABASE_URL=sqlite://
+ # Drop python 3.3 with postgres due lack of driver
+ - python: 3.3
+ env: DJANGO_VERSION=1.7.10 DATABASE_URL=postgres://postgres@/django_guardian
+ - python: 3.3
+ env: DJANGO_VERSION=1.8.7 DATABASE_URL=postgres://postgres@/django_guardian
+ - python: 3.3
+ env: DJANGO_VERSION=1.9.1 DATABASE_URL=postgres://postgres@/django_guardian
+ allow_failures:
+ - env: DJANGO_VERSION=master DATABASE_URL=postgres://postgres@/django_guardian
+ - env: DJANGO_VERSION=master DATABASE_URL=mysql://root:@localhost/django_guardian
+ - env: DJANGO_VERSION=master DATABASE_URL=sqlite://
diff --git a/CHANGES b/CHANGES
index 6e63a3d..f3783d2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,39 @@
+Release 1.4.3 (Apr 03, 2016)
+============================
+
+* guardian.VERSION should be a tuple, not a list. Fixes #411.
+* Support for prefetching permissions.
+* Fixed union between queries.
+* Allow specifying an empty list of permissions for get_objects_for_group.
+* Mixed group and user direction relations broken. Fixes #271.
+* Lookup anonymous user using custom username field.
+* Fix up processing of ANONYMOUS_USER_NAME where set to None. Fixes #409.
+* Require TEMPLATE_403 to exist if RENDER_403 set.
+
+Release 1.4.2 (Mar 09, 2016)
+============================
+
+* Test against django-master (Django 1.10 - not released).
+* Django 1.10 fixes.
+* Fixes for documentation.
+* PEP8 fixes.
+* Fix distributed files in MANIFEST.in
+* Use pytest for tests.
+* Add dependancy on django-environ.
+* Don't use ANONYMOUS_USER_ID. Uses ANONYMOUS_DEFAULT_USERNAME
+ and USERNAME_FIELD instead.
+* Use setuptools_scm for versioning.
+* Initialise admin context using each_context for Django >= 1.8.
+* Add missing with_superusers parameter to get_users_with_perms().
+* Use setuptools scm for versioning.
+* Fixes for example_project.
+* Only display permissions if permission actually assigned.
+* When using `attach_perms` with `get_users_with_perms`, and `with_group_users`
+ and `with_superusers` set to `False`, only directly assigned permissions are
+ now returned, and not effective (infered) permissions.
+
Release 1.4.1 (Jan 10, 2016)
-===========================
+============================
* Fix broken documentation.
* Fix setup.py errors (#387).
diff --git a/MANIFEST.in b/MANIFEST.in
index 92df0a6..6c0715c 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,15 +2,36 @@ include CHANGES
include LICENSE
include README.rst
include MANIFEST.in
-include extras.py
-include tests.py
+include *.py
include run_test_and_report.sh
+include *.txt
+include AUTHORS
+include tox.ini
recursive-include guardian *.py
recursive-include guardian/locale *.po *.mo
recursive-include guardian/fixtures *.json
recursive-include guardian/templates *.html
recursive-include guardian/tests/templates *.html
-recursive-include docs *
-recursive-exclude example_project *
+recursive-include docs *.bat
+recursive-include docs *.conf
+recursive-include docs *.css
+recursive-include docs *.eot
+recursive-include docs *.html
+recursive-include docs *.js
+recursive-include docs *.py
+recursive-include docs *.rb
+recursive-include docs *.rst
+recursive-include docs *.sass
+recursive-include docs *.sh
+recursive-include docs *.svg
+recursive-include docs *.ttf
+recursive-include docs *.woff
+recursive-include docs Makefile
+recursive-include example_project *.css
+recursive-include example_project *.html
+recursive-include example_project *.js
+recursive-include example_project *.png
+recursive-include example_project *.txt
recursive-exclude docs/build *
-recursive-exclude benchmarks *
+recursive-include guardian *.html
+recursive-include guardian *.svg
diff --git a/PKG-INFO b/PKG-INFO
index e779708..2682d36 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,13 +1,13 @@
Metadata-Version: 1.1
Name: django-guardian
-Version: 1.4.1
+Version: 1.4.3
Summary: Implementation of per object permissions for Django.
Home-page: http://github.com/django-guardian/django-guardian
Author: Lukasz Balcerzak
Author-email: lukaszbalcerzak at gmail.com
License: BSD
Download-URL: https://github.com/django-guardian/django-guardian/tags
-Description: 1.4.1
+Description: ===============
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
diff --git a/README.rst b/README.rst
index b8ba0e6..3ad0dee 100644
--- a/README.rst
+++ b/README.rst
@@ -40,10 +40,6 @@ We need to hook ``django-guardian`` into our project.
'guardian.backends.ObjectPermissionBackend',
)
-3. Configure anonymous user ID in your `settings.py`::
-
- ANONYMOUS_USER_ID = -1
-
4. Create ``guardian`` database tables by running::
python manage.py migrate
diff --git a/VERSION.txt b/VERSION.txt
deleted file mode 100644
index 347f583..0000000
--- a/VERSION.txt
+++ /dev/null
@@ -1 +0,0 @@
-1.4.1
diff --git a/benchmarks/__init__.py b/benchmarks/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/benchmarks/models.py b/benchmarks/models.py
new file mode 100644
index 0000000..f36c92b
--- /dev/null
+++ b/benchmarks/models.py
@@ -0,0 +1,19 @@
+from django.db import models
+from guardian.models import UserObjectPermissionBase
+from guardian.models import GroupObjectPermissionBase
+
+
+class TestModel(models.Model):
+ name = models.CharField(max_length=128)
+
+
+class DirectUser(UserObjectPermissionBase):
+ content_object = models.ForeignKey('TestDirectModel')
+
+
+class DirectGroup(GroupObjectPermissionBase):
+ content_object = models.ForeignKey('TestDirectModel')
+
+
+class TestDirectModel(models.Model):
+ name = models.CharField(max_length=128)
diff --git a/benchmarks/run_benchmarks.py b/benchmarks/run_benchmarks.py
new file mode 100644
index 0000000..a7996d4
--- /dev/null
+++ b/benchmarks/run_benchmarks.py
@@ -0,0 +1,190 @@
+#!/usr/bin/env python
+"""
+This benchmark package should be treated as work-in-progress, not a production
+ready benchmarking solution for django-guardian.
+"""
+import datetime
+import os
+import random
+import string
+import sys
+
+abspath = lambda *p: os.path.abspath(os.path.join(*p))
+
+THIS_DIR = abspath(os.path.dirname(__file__))
+ROOT_DIR = abspath(THIS_DIR, '..')
+
+# so the preferred guardian module is one within this repo and
+# not system-wide
+sys.path.insert(0, ROOT_DIR)
+
+os.environ["DJANGO_SETTINGS_MODULE"] = 'benchmarks.settings'
+
+import django
+django.setup()
+
+from benchmarks import settings
+from guardian.shortcuts import assign_perm
+from django.core.exceptions import ImproperlyConfigured
+from utils import show_settings
+from django.contrib.auth.models import User, Group
+from django.utils.termcolors import colorize
+from benchmarks.models import TestModel
+from benchmarks.models import TestDirectModel
+from guardian.models import UserObjectPermission
+from django.contrib.contenttypes.models import ContentType
+
+USERS_COUNT = 50
+OBJECTS_COUNT = 100
+OBJECTS_WIHT_PERMS_COUNT = 100
+
+
+def random_string(length=25, chars=string.ascii_letters + string.digits):
+ return ''.join(random.choice(chars) for i in range(length))
+
+
+def get_model_name(model):
+ """
+ Returns the name of the model
+ """
+ # model._meta.module_name is deprecated in django version 1.7 and removed in django version 1.8.
+ # It is replaced by model._meta.model_name
+ return model._meta.model_name
+
+
+class Call(object):
+
+ def __init__(self, args, kwargs, start=None, finish=None):
+ self.args = args
+ self.kwargs = kwargs
+ self.start = start
+ self.finish = finish
+
+ def delta(self):
+ return self.finish - self.start
+
+
+class Timed(object):
+
+ def __init__(self, action=None):
+ self.action = action
+
+ def __call__(self, func):
+
+ if not hasattr(func, 'calls'):
+ func.calls = []
+
+ def wrapper(*args, **kwargs):
+ if self.action:
+ print(" -> [%s]" % self.action)
+ start = datetime.datetime.now()
+ call = Call(list(args), dict(kwargs), start)
+ try:
+ return func(*args, **kwargs)
+ finally:
+ call.finish = datetime.datetime.now()
+ func.calls.append(call)
+ if self.action:
+ print(" -> [%s] Done (Total time: %s)" % (self.action,
+ call.delta()))
+ return wrapper
+
+
+class Benchmark(object):
+
+ def __init__(self, name, users_count, objects_count,
+ objects_with_perms_count, model, subquery):
+ self.name = name
+ self.users_count = users_count
+ self.objects_count = objects_count
+ self.objects_with_perms_count = objects_with_perms_count
+ self.subquery = subquery
+ self.Model = model
+ self.perm = 'add_%s' % get_model_name(model)
+
+ def info(self, msg):
+ print(colorize(msg + '\n', fg='green'))
+
+ def prepare_db(self):
+ from django.core.management import call_command
+ call_command('syncdb', interactive=False)
+
+ for model in [User, Group, self.Model]:
+ model.objects.all().delete()
+
+ @Timed("Creating users")
+ def create_users(self):
+ User.objects.bulk_create(User(id=x, username=random_string().capitalize())
+ for x in range(self.users_count))
+
+ @Timed("Creating objects")
+ def create_objects(self):
+ Model = self.Model
+ Model.objects.bulk_create(Model(id=x, name=random_string(20))
+ for x in range(self.objects_count))
+
+ @Timed("Grant permissions")
+ def grant_perms(self):
+ ids = range(1, self.objects_count)
+ for user in User.objects.iterator():
+ for x in xrange(self.objects_with_perms_count):
+ obj = self.Model.objects.get(id=random.choice(ids))
+ self.grant_perm(user, obj, self.perm)
+
+ def grant_perm(self, user, obj, perm):
+ assign_perm(perm, user, obj)
+
+ @Timed("Check permissions")
+ def check_perms(self):
+ ids = range(1, self.objects_count)
+ for user in User.objects.iterator():
+ for x in xrange(self.objects_with_perms_count):
+ obj = self.Model.objects.get(id=random.choice(ids))
+ self.check_perm(user, obj, self.perm)
+
+ @Timed("Get objects")
+ def get_objects(self):
+ ctype = ContentType.objects.get_for_model(self.Model)
+ ids = range(1, self.users_count)
+ for user in User.objects.iterator():
+ for x in xrange(self.objects_with_perms_count):
+ filters = {'user': random.choice(ids),
+ 'permission__codename__in': [self.perm],
+ 'content_type': ctype
+ }
+ qs = UserObjectPermission.objects.filter(**filters).all()
+ if not self.subquery:
+ qs = [v.object_pk for v in qs]
+ list(self.Model.objects.filter(id__in=qs))
+
+ def check_perm(self, user, obj, perm):
+ user.has_perm(perm, obj)
+
+ @Timed("Benchmark")
+ def main(self):
+ self.info('=' * 80)
+ self.info(self.name.center(80))
+ self.info('=' * 80)
+ self.prepare_db()
+ self.create_users()
+ self.create_objects()
+ self.grant_perms()
+ self.check_perms()
+ if not isinstance(self.Model, TestModel):
+ self.get_objects()
+
+
+def main():
+ show_settings(settings, 'benchmarks')
+ glob = [USERS_COUNT, OBJECTS_COUNT, OBJECTS_WIHT_PERMS_COUNT]
+ Benchmark('Direct relations benchmark with subqueries', *glob,
+ model=TestDirectModel, subquery=True).main()
+
+ Benchmark('Direct relations benchmark without subqueries', *glob,
+ model=TestDirectModel, subquery=False).main()
+
+ Benchmark('Generic relations benchmark without subqueries', *glob,
+ model=TestModel, subquery=False).main()
+
+if __name__ == '__main__':
+ main()
diff --git a/benchmarks/settings.py b/benchmarks/settings.py
new file mode 100644
index 0000000..ddaa236
--- /dev/null
+++ b/benchmarks/settings.py
@@ -0,0 +1,30 @@
+import os
+import sys
+import environ
+
+env = environ.Env()
+
+abspath = lambda *p: os.path.abspath(os.path.join(*p))
+
+THIS_DIR = abspath(os.path.dirname(__file__))
+ROOT_DIR = abspath(THIS_DIR, '..')
+
+# so the preferred guardian module is one within this repo and
+# not system-wide
+sys.path.insert(0, ROOT_DIR)
+
+SECRET_KEY = 'NO_NEED_SECRET'
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.sessions',
+ 'django.contrib.contenttypes',
+ 'django.contrib.admin',
+ 'django.contrib.sites',
+ 'guardian',
+ 'benchmarks',
+)
+
+DJALOG_LEVEL = 40
+
+DATABASES = {'default': env.db(default="sqlite:///")}
diff --git a/django_guardian.egg-info/PKG-INFO b/django_guardian.egg-info/PKG-INFO
index e779708..2682d36 100644
--- a/django_guardian.egg-info/PKG-INFO
+++ b/django_guardian.egg-info/PKG-INFO
@@ -1,13 +1,13 @@
Metadata-Version: 1.1
Name: django-guardian
-Version: 1.4.1
+Version: 1.4.3
Summary: Implementation of per object permissions for Django.
Home-page: http://github.com/django-guardian/django-guardian
Author: Lukasz Balcerzak
Author-email: lukaszbalcerzak at gmail.com
License: BSD
Download-URL: https://github.com/django-guardian/django-guardian/tags
-Description: 1.4.1
+Description: ===============
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
diff --git a/django_guardian.egg-info/SOURCES.txt b/django_guardian.egg-info/SOURCES.txt
index 1a51a97..dc659cc 100644
--- a/django_guardian.egg-info/SOURCES.txt
+++ b/django_guardian.egg-info/SOURCES.txt
@@ -5,16 +5,19 @@ CHANGES
LICENSE
MANIFEST.in
README.rst
-VERSION.txt
extras.py
manage.py
+pytest.ini
requirements.txt
run_test_and_report.sh
setup.cfg
setup.py
-tests.py
tox.ini
utils.py
+benchmarks/__init__.py
+benchmarks/models.py
+benchmarks/run_benchmarks.py
+benchmarks/settings.py
django_guardian.egg-info/PKG-INFO
django_guardian.egg-info/SOURCES.txt
django_guardian.egg-info/dependency_links.txt
@@ -25,16 +28,12 @@ docs/Makefile
docs/conf.py
docs/configuration.rst
docs/exts.py
-docs/exts.pyc
docs/index.rst
docs/installation.rst
docs/license.rst
docs/make.bat
docs/overview.rst
docs/watch-docs.sh
-docs/__pycache__/exts.cpython-33.pyc
-docs/__pycache__/exts.cpython-34.pyc
-docs/__pycache__/exts.cpython-35.pyc
docs/api/guardian.admin.rst
docs/api/guardian.backends.rst
docs/api/guardian.core.rst
@@ -53,28 +52,6 @@ docs/develop/index.rst
docs/develop/overview.rst
docs/develop/supported-versions.rst
docs/develop/testing.rst
-docs/theme/rtd_theme/breadcrumbs.html
-docs/theme/rtd_theme/footer.html
-docs/theme/rtd_theme/layout.html
-docs/theme/rtd_theme/layout_old.html
-docs/theme/rtd_theme/search.html
-docs/theme/rtd_theme/searchbox.html
-docs/theme/rtd_theme/theme.conf
-docs/theme/rtd_theme/versions.html
-docs/theme/rtd_theme/sass/_badge.sass
-docs/theme/rtd_theme/sass/_badge_font_awesome_mini.sass
-docs/theme/rtd_theme/sass/_breadcrumbs.sass
-docs/theme/rtd_theme/sass/_nav.sass
-docs/theme/rtd_theme/sass/badge_only.sass
-docs/theme/rtd_theme/sass/config.rb
-docs/theme/rtd_theme/sass/theme.sass
-docs/theme/rtd_theme/static/badge_only.css
-docs/theme/rtd_theme/static/theme.css
-docs/theme/rtd_theme/static/theme.js
-docs/theme/rtd_theme/static/font/fontawesome_webfont.eot
-docs/theme/rtd_theme/static/font/fontawesome_webfont.svg
-docs/theme/rtd_theme/static/font/fontawesome_webfont.ttf
-docs/theme/rtd_theme/static/font/fontawesome_webfont.woff
docs/userguide/admin-integration.rst
docs/userguide/assign.rst
docs/userguide/caveats.rst
@@ -84,6 +61,35 @@ docs/userguide/example_project.rst
docs/userguide/index.rst
docs/userguide/performance.rst
docs/userguide/remove.rst
+example_project/__init__.py
+example_project/context_processors.py
+example_project/manage.py
+example_project/requirements.txt
+example_project/settings.py
+example_project/urls.py
+example_project/core/__init__.py
+example_project/core/admin.py
+example_project/core/models.py
+example_project/core/migrations/0001_initial.py
+example_project/core/migrations/__init__.py
+example_project/posts/__init__.py
+example_project/posts/admin.py
+example_project/posts/models.py
+example_project/posts/urls.py
+example_project/posts/views.py
+example_project/posts/migrations/0001_initial.py
+example_project/posts/migrations/__init__.py
+example_project/posts/templates/posts/post_detail.html
+example_project/posts/templates/posts/post_list.html
+example_project/static/css/bootstrap.min.css
+example_project/static/img/glyphicons-halflings-white.png
+example_project/static/img/glyphicons-halflings.png
+example_project/static/js/bootstrap.min.js
+example_project/templates/403.html
+example_project/templates/404.html
+example_project/templates/500.html
+example_project/templates/base.html
+example_project/templates/home.html
guardian/__init__.py
guardian/admin.py
guardian/apps.py
@@ -99,6 +105,7 @@ guardian/mixins.py
guardian/models.py
guardian/shortcuts.py
guardian/utils.py
+guardian/version.py
guardian/conf/__init__.py
guardian/conf/settings.py
guardian/locale/es/LC_MESSAGES/django.mo
@@ -139,6 +146,8 @@ guardian/testapp/migrations/0002_logentrywithgroup.py
guardian/testapp/migrations/0003_auto_20141124_0729.py
guardian/testapp/migrations/0004_auto_20151112_2209.py
guardian/testapp/migrations/0005_auto_20151217_2344.py
+guardian/testapp/migrations/0006_auto_20160221_1054.py
+guardian/testapp/migrations/0007_auto_20160309_0245.py
guardian/testapp/migrations/__init__.py
guardian/testapp/tests/__init__.py
guardian/testapp/tests/conf.py
diff --git a/docs/__pycache__/exts.cpython-33.pyc b/docs/__pycache__/exts.cpython-33.pyc
deleted file mode 100644
index 1db2aec..0000000
Binary files a/docs/__pycache__/exts.cpython-33.pyc and /dev/null differ
diff --git a/docs/__pycache__/exts.cpython-34.pyc b/docs/__pycache__/exts.cpython-34.pyc
deleted file mode 100644
index 01ad132..0000000
Binary files a/docs/__pycache__/exts.cpython-34.pyc and /dev/null differ
diff --git a/docs/__pycache__/exts.cpython-35.pyc b/docs/__pycache__/exts.cpython-35.pyc
deleted file mode 100644
index 270f594..0000000
Binary files a/docs/__pycache__/exts.cpython-35.pyc and /dev/null differ
diff --git a/docs/api/guardian.shortcuts.rst b/docs/api/guardian.shortcuts.rst
index b2e8c7a..23f24fd 100644
--- a/docs/api/guardian.shortcuts.rst
+++ b/docs/api/guardian.shortcuts.rst
@@ -28,6 +28,22 @@ get_perms
.. autofunction:: guardian.shortcuts.get_perms
+.. _api-shortcuts-get_user_perms:
+
+get_user_perms
+--------------
+
+.. autofunction:: guardian.shortcuts.get_user_perms
+
+
+.. _api-shortcuts-get_group_perms:
+
+get_group_perms
+---------------
+
+.. autofunction:: guardian.shortcuts.get_group_perms
+
+
.. _api-shortcuts-get_perms_for_model:
get_perms_for_model
diff --git a/docs/conf.py b/docs/conf.py
index 87077c6..5b2fc68 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,7 +11,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import sys
+import os
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -19,13 +21,12 @@ import sys, os
sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__))))
os.environ['DJANGO_SETTINGS_MODULE'] = 'guardian.testapp.testsettings'
-ANONYMOUS_USER_ID = -1 # Required by guardian
guardian = __import__('guardian')
import django
django.setup()
-# -- General configuration -----------------------------------------------------
+# -- General configuration -----------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -60,11 +61,11 @@ copyright = u'2010-2013, Lukasz Balcerzak'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-with open('../VERSION.txt', 'r') as f:
- # The short X.Y version.
- version = f.readline().strip()
- # The full version, including alpha/beta/rc tags.
- release = version
+# The short X.Y version.
+from setuptools_scm import get_version
+version = get_version(root="..")
+# The full version, including alpha/beta/rc tags.
+release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -104,23 +105,21 @@ pygments_style = 'sphinx'
#modindex_common_prefix = []
-# -- Options for HTML output ---------------------------------------------------
+# -- Options for HTML output ---------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
#html_theme = 'default'
-# Theme URL: https://github.com/coordt/ADCtheme/
-RTD_NEW_THEME = True
-html_theme = 'rtd_theme'
+if not on_rtd: # only import and set the theme if we're building docs locally
+ import sphinx_rtd_theme
+ html_theme = 'sphinx_rtd_theme'
+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
-# Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = ['theme']
-
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
@@ -140,7 +139,7 @@ html_theme_path = ['theme']
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['theme/rtd_theme/static']
+html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
@@ -181,7 +180,7 @@ html_static_path = ['theme/rtd_theme/static']
htmlhelp_basename = 'guardiandoc'
-# -- Options for LaTeX output --------------------------------------------------
+# -- Options for LaTeX output --------------------------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
@@ -192,8 +191,8 @@ htmlhelp_basename = 'guardiandoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'guardian.tex', u'guardian Documentation',
- u'Lukasz Balcerzak', 'manual'),
+ ('index', 'guardian.tex', u'guardian Documentation',
+ u'Lukasz Balcerzak', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -217,8 +216,7 @@ pdf_documents = [
('index', u'django-guardian', u'Documentation for django-guardian',
u'Lukasz Balcerzak'),
]
-pdf_stylesheets = ['sphinx','kerning','a4']
+pdf_stylesheets = ['sphinx', 'kerning', 'a4']
pdf_break_level = 2
pdf_inline_footnotes = True
#pdf_extensions = ['vectorpdf', 'dotted_toc']
-
diff --git a/docs/configuration.rst b/docs/configuration.rst
index c4f08cf..64a11e2 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -19,11 +19,6 @@ and hook guardian's authentication backend::
'guardian.backends.ObjectPermissionBackend',
)
-As ``django-guardian`` supports anonymous user's object permissions we also
-need to add following to our settings module::
-
- ANONYMOUS_USER_ID = -1
-
.. note::
Once project is configured to work with ``django-guardian``, calling
``syncdb`` management command would create ``User`` instance for
@@ -43,10 +38,6 @@ need to add following to our settings module::
anon = User.get_anonymous()
anon.is_anonymous() # returns False
-If ``ANONYMOUS_USER_ID`` is set to ``None``, anonymous user object permissions
-are disabled. You may need to choose this option if creating a ``User`` object
-to represent anonymous users would be problematic in your environment.
-
We can change id to whatever we like. Project should be now ready to use object
permissions.
@@ -54,8 +45,7 @@ permissions.
Optional settings
=================
-In addition to required ``ANONYMOUS_USER_ID`` setting, guardian has following,
-optional configuration variables:
+Guardian has following, optional configuration variables:
.. setting:: GUARDIAN_RAISE_403
@@ -107,18 +97,22 @@ Tells parts of guardian what template to use for responses with status code
``403.html``.
-.. setting:: ANONYMOUS_DEFAULT_USERNAME_VALUE
+.. setting:: ANONYMOUS_USER_NAME
-ANONYMOUS_DEFAULT_USERNAME_VALUE
---------------------------------
+ANONYMOUS_USER_NAME
+-------------------
+
+.. versionadded:: 1.4.2
+
+This is the username of the anonymous user. Used to create the anonymous user
... 6898 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-guardian.git
More information about the Python-modules-commits
mailing list