Example #1
0
    def __str__(self):
        keys = utils.attr_dict(self)
        keys['hexid'] = hex(id(self))
        keys['ndim'] = self.ndim
        return ("""
Grid object <%(hexid)s>
    mesh: (%(_mesh)s
    ndim: %(ndim)i
    dx  : %(dx)s
    shape: %(shape)s
    domain:\n%(domain)s
        """ % keys)
Example #2
0
    def __str__(self):
        keys = utils.attr_dict(self)
        keys["hexid"] = hex(id(self))
        keys["ndim"] = self.ndim
        return (
            """
Grid object <%(hexid)s>
    mesh: (%(_mesh)s
    ndim: %(ndim)i
    dx  : %(dx)s
    shape: %(shape)s
    domain:\n%(domain)s
        """
            % keys
        )
Example #3
0
 def _before_find(self, primary_key_value):
     if primary_key_value and self.table in ('user', 'photo'):
         redis_key = REDIS_KEY['TABLE_ITEMS'].format(table = self.table)
         redis_client = get_redis_client()
         result = redis_client.hget(redis_key, primary_key_value)
         return attr_dict(json.loads(result)) if result else None