Changeset 270
- Timestamp:
- 06/05/09 14:38:06 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
enpraxis.staticsite/trunk/enpraxis/staticsite/utilities/staticsiteutility.py
r269 r270 1 1 from Globals import BobobaseName 2 2 from os import makedirs as os_makedirs 3 from os.path import getmtime 4 from os.path import join as os_join 3 5 from os.path import lexists as os_lexists 4 6 from os.path import split as os_split 5 from os.path import join as os_join 7 8 6 9 from urllib2 import urlopen 7 10 … … 47 50 """ Deploy an object """ 48 51 portal_url = brain.portal_url() 52 last_modified = brain.modified 49 53 if brain.is_folderish: 50 54 #create dir before processing html … … 53 57 index_path = '%s/index.html' % path 54 58 raw = self._httpget(url) 55 self._writeFile(index_path, raw )59 self._writeFile(index_path, raw, last_modified) 56 60 elif brain.Type in ['Page']: 57 61 path = self._getObjPath(url, portal_url, dpath) … … 61 65 if domain: 62 66 data = self.runFilters(raw, None, portal_url, domain) 63 self._writeFile(path, data )67 self._writeFile(path, data, last_modified) 64 68 else: 65 69 #get file object 66 70 path = self._getObjPath(url, portal_url, dpath) 67 71 raw = self._httpget(url) 68 self._writeFile(path, raw )72 self._writeFile(path, raw, last_modified) 69 73 70 74 … … 98 102 return data 99 103 100 def _writeFile(self, fn, data ):104 def _writeFile(self, fn, data, last_modified): 101 105 self._createDirectory(os_split(fn)[0]) 102 f = open(fn, 'w') 103 f.write(data) 104 f.close() 106 if os_lexists(fn): 107 fn_time = getmtime(fn) 108 if last_modified.greaterThan(fn_time): 109 f = open(fn, 'w') 110 f.write(data) 111 f.close() 112 else: 113 f = open(fn, 'w') 114 f.write(data) 115 f.close() 116 117
Note: See TracChangeset
for help on using the changeset viewer.
