def _require_permission_set(user, directory, positive_permissions=None, negative_permissions=None):
 from pootle_app.models.permissions import PermissionSet
 criteria = {'user': user, 'directory': directory}
 permission_set = PermissionSet.objects.get_or_create(**criteria)[0]
 if (positive_permissions is not None):
  permission_set.positive_permissions.set(positive_permissions)
 if (negative_permissions is not None):
  permission_set.negative_permissions.set(negative_permissions)
 permission_set.save()
 return permission_set

def _require_permission_set ( user , directory , positive_permissions = None , negative_permissions = None ) : from pootle_app . models . permissions import PermissionSet criteria = { 'user' : user , 'directory' : directory } permission_set = PermissionSet . objects . get_or_create ( ** criteria ) [ 0 ] if ( positive_permissions is not None ) : permission_set . positive_permissions . set ( positive_permissions ) if ( negative_permissions is not None ) : permission_set . negative_permissions . set ( negative_permissions ) permission_set . save ( ) return permission_set
helper to get/create a new permissionset .