Changeset 573
- Timestamp:
- 10/04/07 19:39:31 (1 year ago)
- Files:
-
- pagoda/trunk/Pagoda/pagoda/command.py (modified) (2 diffs)
- pagoda/trunk/Pagoda/pagoda/site/manager.py (modified) (3 diffs)
- pagoda/trunk/Pagoda/pagoda/site/mapper.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pagoda/trunk/Pagoda/pagoda/command.py
r572 r573 70 70 "Enter site dburi [ex. sqlite:///devdata.sqlite]: " 71 71 ) 72 while not site.get('domain _globs', ''):73 site['domain _globs'] = raw_input(72 while not site.get('domains', ''): 73 site['domains'] = raw_input( 74 74 "Enter domain globs [ex. *.mysite.com, www.myothersite.*]: " 75 75 ) … … 93 93 create_site( 94 94 site['name'], 95 site['dburi'],96 site['domain_globs'],97 site['use_app_resources']95 dburi=site['dburi'], 96 domains=site['domains'], 97 use_app_resources=site['use_app_resources'] 98 98 ) 99 print "Success: Site %r created." % site _name99 print "Success: Site %r created." % site['name'] 100 100 101 101 def site_remove(self, *args): pagoda/trunk/Pagoda/pagoda/site/manager.py
r572 r573 93 93 # Raise NameError if site_name is not in config 94 94 if not is_site(site_name): 95 raise NameError("Error removing site %r: " 96 "Site does not exist in configuration!") 95 raise NameError( 96 "Error removing site %r: " 97 "Site does not exist in configuration!" % site_name 98 ) 97 99 98 100 # Remove site-specific resource directories … … 123 125 return sites.keys() 124 126 125 def create_site(site_name, dburi , domain_globs, use_app_resources=False):127 def create_site(site_name, dburi='', domains='', use_app_resources=False): 126 128 """Create a new PagodaCMS site using the supplied parameters.""" 127 129 … … 131 133 sites[site_name] = dict() 132 134 sites[site_name]['dburi'] = dburi 133 sites[site_name]['domain _globs'] = domain_globs135 sites[site_name]['domains'] = domains 134 136 135 137 # Create site directory, if not using existing app resources pagoda/trunk/Pagoda/pagoda/site/mapper.py
r572 r573 18 18 19 19 __all__ = ['PagodaSiteFilter', 'SITE_DOMAINS', 'update_domain_map', 20 'get_site_name' ]20 'get_site_name', 'DEFAULT_SITE_NAME'] 21 21 22 22 SITE_DOMAINS = {} 23 DEFAULT_SITE_NAME = 'default' 23 24 24 25 def update_domain_map(domain_map=SITE_DOMAINS): … … 69 70 if glob.fnmatch.fnmatch(url_domain, site_domain): 70 71 return site_name 72 # If no domain glob matched, return default site (if there is one) 73 if domain_map.has_key(DEFAULT_SITE_NAME): 74 return DEFAULT_SITE_NAME 71 75 72 76 class PagodaSiteFilter(cherrypy.filters.basefilter.BaseFilter): … … 84 88 if site_name: 85 89 request.headers[self.PAGODA_SITE_HEADER] = site_name 90 else: 91 raise cherrypy.HTTPError( 92 status=500, 93 message="Site not found!" 94 )
