Changeset 530
- Timestamp:
- 08/06/09 16:43:23 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
enpraxis.staticsite/trunk/enpraxis/staticsite/utilities/staticsiteutility.py
r529 r530 79 79 for x in ssprops.getProperty('base_files'): 80 80 objurl = urlunparse((url[0], url[1], '/'.join(urlpath + [x]), url[3], url[4], url[5])) 81 path = self._getObjPath(objurl, portal_url, dpath)81 #path = self._getObjPath(objurl, portal_url, dpath) 82 82 raw = self._httpget(objurl) 83 if 'text' not in guess_type(x): 83 ftype = guess_type(x)[0] 84 if ftype is None: 85 path = self._getObjPath(objurl, portal_url, dpath) 86 self._writeFile(path, raw) 87 elif 'css' in ftype: 88 path = self._getObjPath(objurl, portal_url, dpath + 'css/') 89 self._writeFile(path, raw) 90 elif 'javascript' in ftype: 91 path = self._getObjPath(objurl, portal_url, dpath + 'js/') 92 self._writeFile(path, raw) 93 elif 'image' in ftype: 94 path = self._getObjPath(objurl, portal_url, dpath + 'images/') 84 95 self._writeFile(path, raw, True) 85 96 else: 97 path = self._getObjPath(objurl, portal_url, dpath) 86 98 self._writeFile(path, raw) 87 88 # Deploy C SS99 100 # Deploy Current Theme CSS 89 101 cssreg = context.portal_css 90 102 cssurl = cssreg.absolute_url() … … 98 110 self._writeFile(path, raw) 99 111 100 # Deploy C SS Images into the appropriate skin folder112 # Deploy Current Theme CSS Images into the appropriate skin folder 101 113 css_images = ssprops.getProperty('css_images') 102 114 if len(css_images) > 0: … … 224 236 soup = BeautifulSoup(raw) 225 237 self.deployDocumentActions(portal, aurl, dpath, soup, ssprops) 226 self.deployPresentationView(portal, aurl, dpath, soup, ssprops) 238 self.deployPresentationView(portal, aurl, dpath, soup, ssprops) 227 239 self.deployNonActionNonHTMLViews(portal, aurl, dpath, soup, ssprops) 228 240 if isFolderish: … … 237 249 mpath += '.html' 238 250 self._writeFile(mpath, body) 251 239 252 240 253 def deployPresentationView(self, portal, current, dpath, soup, ssprops): … … 264 277 mpath += '.html' 265 278 self._writeFile(mpath, body) 266 279 267 280 268 281 def deployDocumentActions(self, portal, current, dpath, soup, ssprops): … … 335 348 self.filterJSLinks(soup, current) 336 349 self.filterS5BaseUrl(soup, current) 350 self.filterBaseFilesLinks(soup, current, portal, ssprops) 337 351 self.filterImageFullscreenBackLink(soup, current) 338 352 self.filterCSSValidatorLink(soup, current, portal, ssprops) … … 425 439 url = ie_css.split('url(')[-1] 426 440 url = url.split(');')[0] 441 url.replace('IEFixes.css', 'css/IEFixes.css') 427 442 nurl = self._convertLinkToRelative(url, current) 428 443 ie_css.replaceWith('''<!--[if IE]> … … 471 486 if back.has_key('href'): 472 487 back['href'] = current.replace('image_view_fullscreen.html', 'view.html') 488 489 def filterBaseFilesLinks(self, soup, current, portal, ssprops): 490 portal_url = portal.portal_url() 491 for x in ssprops.getProperty('base_files'): 492 ftype = guess_type(x)[0] 493 if ftype is None: 494 pass 495 elif 'css' in ftype: 496 tags = soup.findAll('link', {'href' : re.compile(x)}) 497 for tag in tags: 498 abs_link = self._convertLinkToAbsolute(tag['href'], current) 499 rel_link = self._convertLinkToRelative(abs_link, current) 500 tag['href'] = rel_link.replace(x, 'css/%s' % x) 501 elif 'javascript' in ftype: 502 tags = soup.findAll('script', {'src' : re.compile(x)}) 503 for tag in tags: 504 abs_link = self._convertLinkToAbsolute(tag['src'], current) 505 rel_link = self._convertLinkToRelative(abs_link, current) 506 tag['src'] = rel_link.replace(x, 'js/%s' % x) 507 elif 'image' in ftype: 508 tags = soup.findAll('img', {'src' : re.compile(x)}) 509 for tag in tags: 510 rel_link = self._convertLinkToRelative(tag['src'], current) 511 tag['src'] = rel_link.replace(x, 'images/%s' % x) 512 513 514 473 515 474 516 def getDocumentLinks(self, soup):
