diff --git a/larpe/trunk/larpe/admin/apache.py b/larpe/trunk/larpe/admin/apache.py index 060b0f8..3fd607f 100644 --- a/larpe/trunk/larpe/admin/apache.py +++ b/larpe/trunk/larpe/admin/apache.py @@ -147,8 +147,8 @@ class Location(object): reversed_directory = property(get_reversed_directory) def get_python_path(self): - if hasattr(self.host, 'apache_output_python_filters') and \ - hasattr(self.host, 'apache_python_paths') and self.host.apache_python_paths: + if self.host.apache_output_python_filters and \ + self.host.apache_python_paths: python_path = 'PythonPath "sys.path' for path in self.host.apache_python_paths: python_path += "+['%s']" % path @@ -161,14 +161,14 @@ class Location(object): def get_output_filters(self): python_filters = '' output_filters = [] - if hasattr(self.host, 'apache_output_python_filters'): + if self.host.apache_output_python_filters: i = 0 for filter_file in self.host.apache_output_python_filters: filter_name = 'filter%d' % i python_filters += 'PythonOutputFilter %s %s\n\t\t' % (filter_file, filter_name) output_filters.append(filter_name) i += 1 - if hasattr(self.host, 'apache_output_filters'): + if self.host.apache_output_filters: for output_filter in self.host.apache_output_filters: output_filters.append(output_filter) if output_filters: diff --git a/larpe/trunk/larpe/admin/hosts.ptl b/larpe/trunk/larpe/admin/hosts.ptl index dc11279..72a07ce 100644 --- a/larpe/trunk/larpe/admin/hosts.ptl +++ b/larpe/trunk/larpe/admin/hosts.ptl @@ -792,19 +792,21 @@ POST request. You can desactivate some or all of them, or change their value.''' self.host.store() def generate_apache_filters(self): - # Set Python filter path for Apache configuration + self.host.apache_python_paths = [] + self.host.apache_output_python_filters = [] site_auth = site_authentication.get_site_authentication(self.host) filters = site_auth.get_filters() replace_login_form = self.host.auth_form_places == 'form_everywhere' and \ self.host.auth_form_action - python_path = os.path.join(self.host.site_dir, 'filters') - if python_path not in self.host.apache_python_paths: - self.host.apache_python_paths.append(python_path) - - # Write Python filter - python_file = open(os.path.join(self.host.site_dir, 'filters', 'output_replace_form.py'), 'w') - python_file.write(open(OUTPUT_FILTER_BASE).read()) if filters or replace_login_form: + # Set Python filter path for Apache configuration + python_path = os.path.join(self.host.site_dir, 'filters') + if python_path not in self.host.apache_python_paths: + self.host.apache_python_paths.append(python_path) + + # Write Python filter + python_file = open(os.path.join(self.host.site_dir, 'filters', 'output_replace_form.py'), 'w') + python_file.write(open(OUTPUT_FILTER_BASE).read()) python_file.write("def filter_page(filter, page):\n") if replace_login_form: python_file.write('''\ @@ -819,10 +821,6 @@ POST request. You can desactivate some or all of them, or change their value.''' # Set Python filter for Apache configuration if not 'output_replace_form' in self.host.apache_output_python_filters: self.host.apache_output_python_filters.append('output_replace_form') - else: - if 'output_replace_form' in self.host.apache_output_python_filters: - self.host.apache_output_python_filters.remove('output_replace_form') - def sso_init_link [html] (self): form = self.form_sso_init_link() diff --git a/larpe/trunk/larpe/site_authentication.ptl b/larpe/trunk/larpe/site_authentication.ptl index b90d942..638a53a 100644 --- a/larpe/trunk/larpe/site_authentication.ptl +++ b/larpe/trunk/larpe/site_authentication.ptl @@ -115,7 +115,7 @@ class SiteAuthentication: filters.append(filter) return filters """ - return None + return list() def submit_local_auth_form(self, form): username = form.get_widget('username').parse()