python/pypngtile.pyx
changeset 170 c756bbcbc102
parent 134 08a0056f6175
equal deleted inserted replaced
169:b69ffcd1ecc7 170:c756bbcbc102
    30 CACHE_FRESH     = PT_CACHE_FRESH
    30 CACHE_FRESH     = PT_CACHE_FRESH
    31 CACHE_NONE      = PT_CACHE_NONE
    31 CACHE_NONE      = PT_CACHE_NONE
    32 CACHE_STALE     = PT_CACHE_STALE
    32 CACHE_STALE     = PT_CACHE_STALE
    33 CACHE_INCOMPAT  = PT_CACHE_INCOMPAT
    33 CACHE_INCOMPAT  = PT_CACHE_INCOMPAT
    34 
    34 
       
    35 import datetime
       
    36 
    35 class Error (Exception) :
    37 class Error (Exception) :
    36     """
    38     """
    37         Base class for errors raised by pypngtile.
    39         Base class for errors raised by pypngtile.
    38     """
    40     """
    39 
    41 
   100         if err :
   102         if err :
   101             raise Error("pt_image_info", err)
   103             raise Error("pt_image_info", err)
   102         
   104         
   103         # return as a struct
   105         # return as a struct
   104         return infop[0]
   106         return infop[0]
   105 
   107     
       
   108     def cache_mtime (self) :
       
   109         """
       
   110             Return cache's mtime as an UTC datetime.
       
   111         """
       
   112 
       
   113         info = self.info()
       
   114 
       
   115         return datetime.datetime.utcfromtimestamp(info['cache_mtime'])
   106 
   116 
   107     def status (self) :
   117     def status (self) :
   108         """
   118         """
   109             Return a code describing the status of the underlying cache file.
   119             Return a code describing the status of the underlying cache file.
   110 
   120