def _check_permission_clashing(custom, builtin, ctype):
 pool = set()
 builtin_codenames = set((p[0] for p in builtin))
 for (codename, _name) in custom:
  if (codename in pool):
   raise CommandError((u"The permission codename '%s' is duplicated for model '%s.%s'." % (codename, ctype.app_label, ctype.model_class().__name__)))
  elif (codename in builtin_codenames):
   raise CommandError((u"The permission codename '%s' clashes with a builtin permission for model '%s.%s'." % (codename, ctype.app_label, ctype.model_class().__name__)))
  pool.add(codename)

def _check_permission_clashing ( custom , builtin , ctype ) : pool = set ( ) builtin_codenames = set ( ( p [ 0 ] for p in builtin ) ) for ( codename , _name ) in custom : if ( codename in pool ) : raise CommandError ( ( u"The permission codename '%s' is duplicated for model '%s.%s'." % ( codename , ctype . app_label , ctype . model_class ( ) . __name__ ) ) ) elif ( codename in builtin_codenames ) : raise CommandError ( ( u"The permission codename '%s' clashes with a builtin permission for model '%s.%s'." % ( codename , ctype . app_label , ctype . model_class ( ) . __name__ ) ) ) pool . add ( codename )
check that permissions for a model do not clash .