def __aliases_get(self): "Getter. Allows for value = self.aliases" aliases = get_prop_cache(self, "_aliases") if aliases == None: aliases = list(Alias.objects.filter(db_obj=self).values_list("db_key", flat=True)) set_prop_cache(self, "_aliases", aliases) return aliases
def __uid_get(self): "Getter. Retrieves the user id" uid = get_prop_cache(self, "_uid") if not uid: uid = _GA(self, "user").id set_prop_cache(self, "_uid", uid) return uid
def __is_superuser_get(self): "Superusers have all permissions." is_suser = get_prop_cache(self, "_is_superuser") if is_suser == None: is_suser = _GA(self, "user").is_superuser set_prop_cache(self, "_is_superuser", is_suser) return is_suser
def __name_get(self): "Getter. Allows for value = self.name" name = get_prop_cache(self, "_name") if not name: name = _GA(self, "user").username set_prop_cache(self, "_name", name) return name
def contents_get(self, exclude=None): """ Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available. exclude is one or more objects to not return """ cont = get_prop_cache(self, "_contents") exclude = make_iter(exclude) if cont == None: cont = _GA(self, "contents_update")() return [obj for obj in cont if obj not in exclude]