コード例 #1
0
    def set_data_key(self, key):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
        """
        # Save data info's key and model
        utils.set_obj_data_key(self, key)

        # Load data.
        self.load_data()

        # initialize with data
        if self.db.FIRST_CREATE:
            self.set_initial_data()
            del self.db.FIRST_CREATE
コード例 #2
0
ファイル: objects.py プロジェクト: carriercomm/muddery
    def set_data_key(self, key):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
        """
        # Save data info's key and model
        utils.set_obj_data_key(self, key)
        
        # Load data.
        self.load_data()

        # initialize with data
        if self.db.FIRST_CREATE:
            self.set_initial_data()
            del self.db.FIRST_CREATE
コード例 #3
0
ファイル: object.py プロジェクト: LiuXiu233/muddery
    def set_data_key(self, key, level, set_location=True):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
            level: (number) object's level.
        """
        # Save data info's key and model
        utils.set_obj_data_key(self, key)

        self.db.level = level

        # Load data.
        try:
            # Load db data.
            self.load_data(set_location=set_location)
        except Exception, e:
            traceback.print_exc()
            logger.log_errmsg("%s(%s) can not load data:%s" %
                              (key, self.dbref, e))
コード例 #4
0
    def set_data_key(self, key, set_location=True):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
        """
        current_key = self.get_data_key(default=None)
        if current_key is not None:
            # Has data key
            if key == current_key:
                # Key has not changed.
                return

        # Save data info's key and model
        utils.set_obj_data_key(self, key)

        # Load data.
        self.load_data(set_location=set_location)

        # call data_key hook
        self.after_data_key_changed()
コード例 #5
0
    def set_data_key(self, key, level=None, reset_location=True):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
            level: (number) object's level.
            reset_location: (boolean) reset the object to its default location.
        """
        # Save data info's key and model
        utils.set_obj_data_key(self, key)
        
        # Load data.
        try:
            # Load db data.
            self.load_data(level, reset_location=reset_location)
        except Exception as e:
            traceback.print_exc()
            logger.log_errmsg("%s(%s) can not load data:%s" % (key, self.dbref, e))

        # call data_key hook
        self.after_data_key_changed()
コード例 #6
0
ファイル: objects.py プロジェクト: kickreg/muddery
    def set_data_key(self, key, set_location=True):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
        """
        current_key = self.get_data_key(default=None)
        if current_key is not None:
            # Has data key
            if key == current_key:
                # Key has not changed.
                return
        
        # Save data info's key and model
        utils.set_obj_data_key(self, key)
        
        # Load data.
        self.load_data(set_location=set_location)

        # call data_key hook
        self.after_data_key_changed()
コード例 #7
0
ファイル: object.py プロジェクト: muddery/muddery
 def set_data_key(self, key, set_location=True):
     """
     Set data_info's model and key. It puts info into attributes.
         
     Args:
         key: (string) Key of the data info.
     """
     current_key = self.get_data_key(default=None)
     if current_key is not None:
         # Has data key
         if key == current_key:
             # Key has not changed.
             return
     
     # Save data info's key and model
     utils.set_obj_data_key(self, key)
     
     # Load data.
     try:
         # Load db data.
         self.load_data(set_location=set_location)
     except Exception, e:
         logger.log_errmsg("%s(%s) can not load data:%s" % (key, self.dbref, e))
コード例 #8
0
    def set_data_key(self, key, set_location=True):
        """
        Set data_info's model and key. It puts info into attributes.
            
        Args:
            key: (string) Key of the data info.
        """
        current_key = self.get_data_key(default=None)
        if current_key is not None:
            # Has data key
            if key == current_key:
                # Key has not changed.
                return

        # Save data info's key and model
        utils.set_obj_data_key(self, key)

        # Load data.
        try:
            # Load db data.
            self.load_data(set_location=set_location)
        except Exception, e:
            logger.log_errmsg("%s(%s) can not load data:%s" %
                              (key, self.dbref, e))