コード例 #1
0
ファイル: models.py プロジェクト: YourCyborg/Sun-RPI
 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
コード例 #2
0
ファイル: models.py プロジェクト: TaliesinSkye/evennia
 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
コード例 #3
0
ファイル: models.py プロジェクト: TaliesinSkye/evennia
 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
コード例 #4
0
ファイル: models.py プロジェクト: TaliesinSkye/evennia
 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
コード例 #5
0
ファイル: models.py プロジェクト: YourCyborg/Sun-RPI
    def contents_update(self):
        """
        Updates the contents property of the object with a new
        object Called by
        self.location_set.

        obj -
        remove (true/false) - remove obj from content list
        """
        cont = ObjectDB.objects.get_contents(self)
        set_prop_cache(self, "_contents", cont)
        return cont
コード例 #6
0
ファイル: models.py プロジェクト: YourCyborg/Sun-RPI
 def __aliases_set(self, aliases):
     "Setter. Allows for self.aliases = value"
     for alias in make_iter(aliases):
         new_alias = Alias(db_key=alias, db_obj=self)
         new_alias.save()
     set_prop_cache(self, "_aliases", make_iter(aliases))
コード例 #7
0
ファイル: models.py プロジェクト: TaliesinSkye/evennia
 def __name_set(self, value):
     "Setter. Allows for player.name = newname"
     _GA(self, "user").username = value
     _GA(self, "user").save()
     set_prop_cache(self, "_name", value)