Changeset 265


Ignore:
Timestamp:
06/04/09 16:47:24 (5 years ago)
Author:
david
Message:

Passing subdomain down to deployObject and updating code to work with deployment_path existing as a property

File:
1 edited

Legend:

Unmodified
Added
Removed
  • enpraxis.staticsite/trunk/enpraxis/staticsite/utilities/staticsiteutility.py

    r264 r265  
    11import Globals 
     2import httplib 
    23import os 
    34 
     
    2627 
    2728        ssprops = context.portal_url.portal_properties.staticsite_properties 
     29        subdomain = ssprops.getProperty('subdomain') 
    2830        rpath = self._getDeploymentPath(ssprops) 
    2931        self.createDirectory(rpath) 
     
    3638            review_state='Published') 
    3739        for x in brains: 
    38             self.traverse(x, rpath) 
     40            self.traverse(x, rpath, subdomain) 
    3941 
    40     def traverse(self, brain, rpath): 
     42    def traverse(self, brain, rpath, subdomain): 
    4143        """ Traverse the site. """ 
    4244        brains = brain.portal_catalog.searchResults( 
     
    4547        for x in brains: 
    4648            url = x.getURL() 
    47             self.deployObject(url, x, rpath) 
    48             if x.isPrincipiaFolderish: 
    49                 self.traverse(x, rpath) 
     49            self.deployObject(url, x, rpath, subdomain) 
     50            if x.is_folderish: 
     51                self.traverse(x, rpath, subdomain) 
    5052             
    51     def deployObject(self, url, brain, rpath): 
     53    def deployObject(self, url, brain, rpath, subdomain): 
    5254        """ Deploy an object """ 
     55        portal_url = brain.portal_url()     
    5356        if brain.is_folderish: 
    5457            #create dir before processing html 
    55             portal_url = brain.portal_url() 
    56             folder_path = url.replace(portal_url, self.static_rootpath) 
     58            folder_path = url.replace(portal_url, rpath) 
    5759            self.createDirectory(folder_path) 
    58         raw = self.httpget(url)         
     60        raw = self.httpget(url, portal_url, subdomain)         
    5961        data = self.runFilters(raw, None) 
    6062        print url 
     
    6466        return data 
    6567     
    66     def httpget(self, url): 
     68    def httpget(self, url, portal_url, subdomain): 
     69        url = url.replace(portal_url, subdomain) 
    6770        return url 
    6871 
Note: See TracChangeset for help on using the changeset viewer.