Open digitalfox opened 9 years ago
bport fix is working, but current master is still broken with the following stacktrace :
ValueError Traceback (most recent call last)
<ipython-input-3-7f9c5fd36175> in <module>()
----> 1 get_roles(s)
/home/fox/prog/workspace/django-1.8/src/django-permissions/permissions/utils.pyc in get_roles(user, obj)
218 if groups_ids_str:
219 prrs = PrincipalRoleRelation.objects.filter(
--> 220 Q(user_id=user.id) | Q(group_id__in=groups_ids_str), content_id=None
221 ).values("role_id")
222 else:
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/manager.pyc in manager_method(self, *args, **kwargs)
125 def create_method(name, method):
126 def manager_method(self, *args, **kwargs):
--> 127 return getattr(self.get_queryset(), name)(*args, **kwargs)
128 manager_method.__name__ = method.__name__
129 manager_method.__doc__ = method.__doc__
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/query.pyc in filter(self, *args, **kwargs)
677 set.
678 """
--> 679 return self._filter_or_exclude(False, *args, **kwargs)
680
681 def exclude(self, *args, **kwargs):
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/query.pyc in _filter_or_exclude(self, negate, *args, **kwargs)
695 clone.query.add_q(~Q(*args, **kwargs))
696 else:
--> 697 clone.query.add_q(Q(*args, **kwargs))
698 return clone
699
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/sql/query.pyc in add_q(self, q_object)
1302 existing_inner = set(
1303 (a for a in self.alias_map if self.alias_map[a].join_type == INNER))
-> 1304 clause, require_inner = self._add_q(where_part, self.used_aliases)
1305 self.where.add(clause, AND)
1306 for hp in having_parts:
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/sql/query.pyc in _add_q(self, q_object, used_aliases, branch_negated, current_negated, allow_joins)
1324 child_clause, needed_inner = self._add_q(
1325 child, used_aliases, branch_negated,
-> 1326 current_negated, allow_joins)
1327 joinpromoter.add_votes(needed_inner)
1328 else:
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/sql/query.pyc in _add_q(self, q_object, used_aliases, branch_negated, current_negated, allow_joins)
1329 child_clause, needed_inner = self.build_filter(
1330 child, can_reuse=used_aliases, branch_negated=branch_negated,
-> 1331 current_negated=current_negated, connector=connector, allow_joins=allow_joins)
1332 joinpromoter.add_votes(needed_inner)
1333 target_clause.add(child_clause, connector)
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/sql/query.pyc in build_filter(self, filter_expr, branch_negated, current_negated, can_reuse, connector, allow_joins)
1192 # refactored when composite fields lands.
1193 condition = field.get_lookup_constraint(self.where_class, alias, targets, sources,
-> 1194 lookups, value)
1195 lookup_type = lookups[-1]
1196 else:
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/fields/related.pyc in get_lookup_constraint(self, constraint_class, alias, targets, sources, lookups, raw_value)
1743 value = [val[0] for val in values]
1744 lookup_class = targets[0].get_lookup(lookup_type)
-> 1745 root_constraint.add(lookup_class(targets[0].get_col(alias, sources[0]), value), AND)
1746 elif lookup_type == 'in':
1747 values = [get_normalized_value(value) for value in raw_value]
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/lookups.pyc in __init__(self, lhs, rhs)
94 def __init__(self, lhs, rhs):
95 self.lhs, self.rhs = lhs, rhs
---> 96 self.rhs = self.get_prep_lookup()
97 if hasattr(self.lhs, 'get_bilateral_transforms'):
98 bilateral_transforms = self.lhs.get_bilateral_transforms()
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/lookups.pyc in get_prep_lookup(self)
132
133 def get_prep_lookup(self):
--> 134 return self.lhs.output_field.get_prep_lookup(self.lookup_name, self.rhs)
135
136 def get_db_prep_lookup(self, value, connection):
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/fields/__init__.pyc in get_prep_lookup(self, lookup_type, value)
727 return self.get_prep_value(value)
728 elif lookup_type in ('range', 'in'):
--> 729 return [self.get_prep_value(v) for v in value]
730 elif lookup_type == 'year':
731 try:
/home/fox/prog/workspace/django-1.8/lib/python2.7/site-packages/django/db/models/fields/__init__.pyc in get_prep_value(self, value)
983 if value is None:
984 return None
--> 985 return int(value)
986
987 def contribute_to_class(self, cls, name, **kwargs)
hello,
I'm looking for the equivalent of has_role of permissions 1.0 that has been removed. I tried get_roles but it fails with ony user as argument. I am using 1.2.2.