Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
View
2  django/core/extensions.py
@@ -25,7 +25,7 @@ class PermLookupDict:
def __init__(self, user, module_name):
self.user, self.module_name = user, module_name
def __repr__(self):
- return str(self.user.get_permissions())
+ return str(self.user.get_permission_list())
def __getitem__(self, perm_name):
return self.user.has_perm("%s.%s" % (self.module_name, perm_name))
def __nonzero__(self):
View
8 django/core/meta.py
@@ -517,10 +517,10 @@ def __new__(cls, name, bases, attrs):
for f in opts.many_to_many:
# Add "get_thingie" methods for many-to-many related objects.
- # EXAMPLES: Poll.get_sites(), Story.get_bylines()
+ # EXAMPLES: Poll.get_site_list(), Story.get_byline_list()
func = curry(method_get_many_to_many, f)
func.__doc__ = "Returns a list of associated `%s.%s` objects." % (f.rel.to.app_label, f.rel.to.module_name)
- attrs['get_%s' % f.name] = func
+ attrs['get_%s_list' % f.rel.name] = func
# Add "set_thingie" methods for many-to-many related objects.
# EXAMPLES: Poll.set_sites(), Story.set_bylines()
func = curry(method_set_many_to_many, f)
@@ -809,7 +809,7 @@ def method_get_many_to_one(field_with_rel, self):
return getattr(self, cache_var)
# Handles getting many-to-many related objects.
-# Example: Poll.get_sites()
+# Example: Poll.get_site_list()
def method_get_many_to_many(field_with_rel, self):
rel = field_with_rel.rel.to
cache_var = '_%s_cache' % field_with_rel.name
@@ -2064,7 +2064,7 @@ class ManyToManyField(Field):
def __init__(self, to, **kwargs):
kwargs['name'] = kwargs.get('name', to._meta.module_name)
kwargs['verbose_name'] = kwargs.get('verbose_name', to._meta.verbose_name_plural)
- kwargs['rel'] = ManyToMany(to, to._meta.object_name.lower() + '_id',
+ kwargs['rel'] = ManyToMany(to, to._meta.object_name.lower(),
num_in_admin=kwargs.pop('num_in_admin', 0),
related_name=kwargs.pop('related_name', None),
filter_interface=kwargs.pop('filter_interface', None),
View
2  django/models/auth.py
@@ -101,7 +101,7 @@ def get_group_permissions(self):
def get_all_permissions(self):
if not hasattr(self, '_perm_cache'):
import sets
- self._perm_cache = sets.Set(["%s.%s" % (p.package, p.codename) for p in self.get_user_permissions()])
+ self._perm_cache = sets.Set(["%s.%s" % (p.package, p.codename) for p in self.get_permission_list()])
self._perm_cache.update(self.get_group_permissions())
return self._perm_cache
View
2  django/models/comments.py
@@ -152,7 +152,7 @@ def _module_user_is_moderator(user):
from django.conf.settings import COMMENTS_MODERATORS_GROUP
if user.is_superuser:
return True
- for g in user.get_groups():
+ for g in user.get_group_list():
if g.id == COMMENTS_MODERATORS_GROUP:
return True
return False
View
6 django/parts/auth/anonymoususers.py
@@ -3,7 +3,7 @@
"""
class AnonymousUser:
-
+
def __init__(self):
pass
@@ -22,13 +22,13 @@ def set_password(self, raw_password):
def check_password(self, raw_password):
raise NotImplementedError
- def get_groups(self):
+ def get_group_list(self):
return []
def set_groups(self, group_id_list):
raise NotImplementedError
- def get_permissions(self):
+ def get_permission_list(self):
return []
def set_permissions(self, permission_id_list):
View
4 django/views/admin/main.py
@@ -897,7 +897,7 @@ def change_stage(request, app_label, module_name, object_id):
new_data.update(_get_flattened_data(f, getattr(obj, f.name)))
for f in opts.many_to_many:
if not f.rel.edit_inline:
- new_data[f.name] = [i.id for i in getattr(obj, 'get_%s' % f.name)()]
+ new_data[f.name] = [i.id for i in getattr(obj, 'get_%s_list' % f.rel.name)()]
for rel_obj, rel_field in inline_related_objects:
var_name = rel_obj.object_name.lower()
for i, rel_instance in enumerate(getattr(obj, 'get_%s_list' % opts.get_rel_object_method_name(rel_obj, rel_field))()):
@@ -906,7 +906,7 @@ def change_stage(request, app_label, module_name, object_id):
for k, v in _get_flattened_data(f, getattr(rel_instance, f.name)).items():
new_data['%s.%d.%s' % (var_name, i, k)] = v
for f in rel_obj.many_to_many:
- new_data['%s.%d.%s' % (var_name, i, f.name)] = [j.id for j in getattr(rel_instance, 'get_%s' % f.name)()]
+ new_data['%s.%d.%s' % (var_name, i, f.name)] = [j.id for j in getattr(rel_instance, 'get_%s_list' % f.rel.name)()]
# If the object has ordered objects on its admin page, get the existing
# order and flatten it into a comma-separated list of IDs.
View
2  django/views/comments/comments.py
@@ -108,7 +108,7 @@ def save(self, new_data):
message = 'This comment was posted by a user who has posted fewer than %s comments:\n\n%s' % \
(COMMENTS_FIRST_FEW, c.get_as_text())
mail_managers("Comment posted by rookie user", message)
- if COMMENTS_SKETCHY_USERS_GROUP and COMMENTS_SKETCHY_USERS_GROUP in [g.id for g in self.user_cache.get_groups()]:
+ if COMMENTS_SKETCHY_USERS_GROUP and COMMENTS_SKETCHY_USERS_GROUP in [g.id for g in self.user_cache.get_group_list()]:
message = 'This comment was posted by a sketchy user:\n\n%s' % c.get_as_text()
mail_managers("Comment posted by sketchy user (%s)" % self.user_cache.username, c.get_as_text())
return c
View
4 django/views/defaults.py
@@ -14,8 +14,8 @@ def shortcut(request, content_type_id, object_id):
if not hasattr(obj, 'get_absolute_url'):
raise Http404, "%s objects don't have get_absolute_url() methods" % content_type.name
object_domain = None
- if hasattr(obj, 'get_sites'):
- site_list = obj.get_sites()
+ if hasattr(obj, 'get_site_list'):
+ site_list = obj.get_site_list()
if site_list:
object_domain = site_list[0].domain
elif hasattr(obj, 'get_site'):
Please sign in to comment.
Something went wrong with that request. Please try again.