1.1 --- a/XSLForms/PyQt.py Tue Oct 25 17:52:28 2005 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,114 +0,0 @@
1.4 -#!/usr/bin/env python
1.5 -
1.6 -import XSLForms.Prepare
1.7 -import qt
1.8 -import qtui
1.9 -import qtxmldom
1.10 -import os
1.11 -
1.12 -class XSLFormsResource:
1.13 -
1.14 - "An XSLForms resource for use with PyQt."
1.15 -
1.16 - template_resources = {}
1.17 - widget_resources = {}
1.18 - document_resources = {}
1.19 -
1.20 - # Helper methods.
1.21 - # NOTE: Should be moved to a superclass.
1.22 -
1.23 - def prepare_document(self, document_identifier):
1.24 - filename = self.document_resources[document_identifier]
1.25 - return os.path.abspath(os.path.join(self.resource_dir, filename))
1.26 -
1.27 - def get_document(self, document_identifier):
1.28 - return qtxmldom.parse(self.prepare_document(document_identifier))
1.29 -
1.30 - def get_elements(self, document_identifier):
1.31 - doc = self.get_document(document_identifier)
1.32 - return doc.getElementsByTagName(document_identifier + "-enum")
1.33 -
1.34 - def prepare_template(self, template_identifier):
1.35 - filename = self.template_resources[template_identifier]
1.36 - return os.path.abspath(os.path.join(self.resource_dir, filename))
1.37 -
1.38 - def prepare_widget(self, template_identifier, widget_identifier, parent=None):
1.39 - template_path = self.prepare_template(template_identifier)
1.40 - fragment_name, widget_name = self.widget_resources[widget_identifier]
1.41 - fragment_path = os.path.abspath(os.path.join(self.resource_dir, fragment_name))
1.42 - XSLForms.Prepare.ensure_qt_fragment(template_path, fragment_path, widget_name)
1.43 - return qtui.QWidgetFactory.create(fragment_path, None, parent)
1.44 -
1.45 - def populate_list(self, field, elements):
1.46 - current_text = field.currentText()
1.47 - while field.count() > 0:
1.48 - field.removeItem(0)
1.49 - item = 0
1.50 - set = 0
1.51 - for element in elements:
1.52 - text = element.getAttribute("value")
1.53 - field.insertItem(text)
1.54 - if text == current_text:
1.55 - field.setCurrentItem(item)
1.56 - set = 1
1.57 - item += 1
1.58 - if not set:
1.59 - field.setCurrentItem(0)
1.60 -
1.61 - def reset_collection(self, field):
1.62 - layout = field.layout()
1.63 - for child in field.children():
1.64 - if child is not layout:
1.65 - layout.remove(child)
1.66 - child.deleteLater()
1.67 -
1.68 -class Factory:
1.69 -
1.70 - "A widget factory helper class."
1.71 -
1.72 - def __init__(self, ui_filename):
1.73 - self.ui_filename = ui_filename
1.74 - self.ui_doc = qtxmldom.parse(ui_filename)
1.75 -
1.76 - def connect(self, widget, obj):
1.77 -
1.78 - for connection in self.ui_doc.getElementsByTagName("connection"):
1.79 - sender_name = self.get_text(connection.getElementsByTagName("sender")[0]).encode("utf-8")
1.80 - signal_name = self.get_text(connection.getElementsByTagName("signal")[0]).encode("utf-8")
1.81 - slot_name = self.get_text(connection.getElementsByTagName("slot")[0]).encode("utf-8")
1.82 -
1.83 - if widget.name() == sender_name:
1.84 - senders = [widget]
1.85 - else:
1.86 - senders = self.find_widgets(widget, sender_name)
1.87 -
1.88 - slot = slot_name.split("(")[0]
1.89 - if hasattr(obj, slot):
1.90 - signal = qt.SIGNAL(signal_name)
1.91 - for sender in senders:
1.92 - qt.QObject.connect(sender, signal, getattr(obj, slot))
1.93 -
1.94 - def find_widgets(self, widget, name):
1.95 - widgets = []
1.96 - found = widget.child(name)
1.97 - if found:
1.98 - widgets.append(found)
1.99 - for child in widget.children():
1.100 - widgets += self.find_widgets(child, name)
1.101 - return widgets
1.102 -
1.103 - def get_text(self, node):
1.104 - node.normalize()
1.105 - return node.childNodes[0].nodeValue
1.106 -
1.107 - def find_widget_element(self, name):
1.108 - for widget in self.ui_doc.getElementsByTagName("widget"):
1.109 - for property in widget.getElementsByTagName("property"):
1.110 - if property.getAttribute("name") == "name":
1.111 - for cstring in property.getElementsByTagName("cstring"):
1.112 - found_name = self.get_text(cstring)
1.113 - if found_name == name:
1.114 - return widget
1.115 - return None
1.116 -
1.117 -# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/XSLForms/Resources.py Tue Oct 25 17:52:28 2005 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,312 +0,0 @@
2.4 -#!/usr/bin/env python
2.5 -
2.6 -"""
2.7 -Resources for use with WebStack.
2.8 -
2.9 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
2.10 -
2.11 -This library is free software; you can redistribute it and/or
2.12 -modify it under the terms of the GNU Lesser General Public
2.13 -License as published by the Free Software Foundation; either
2.14 -version 2.1 of the License, or (at your option) any later version.
2.15 -
2.16 -This library is distributed in the hope that it will be useful,
2.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of
2.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2.19 -Lesser General Public License for more details.
2.20 -
2.21 -You should have received a copy of the GNU Lesser General Public
2.22 -License along with this library; if not, write to the Free Software
2.23 -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2.24 -"""
2.25 -
2.26 -import WebStack.Generic
2.27 -import XSLForms.Fields
2.28 -import XSLForms.Prepare
2.29 -import XSLForms.Output
2.30 -from XSLTools import XSLOutput
2.31 -import os
2.32 -
2.33 -class XSLFormsResource:
2.34 -
2.35 - """
2.36 - A generic XSLForms resource for use with WebStack.
2.37 -
2.38 - When overriding this class, define the following attributes appropriately:
2.39 -
2.40 - * template_resources - a dictionary mapping output identifiers to
2.41 - (template_filename, output_filename) tuples,
2.42 - indicating the template and stylesheet filenames
2.43 - to be employed
2.44 -
2.45 - * in_page_resources - a dictionary mapping fragment identifiers to
2.46 - (output_filename, node_identifier) tuples,
2.47 - indicating the stylesheet filename to be
2.48 - employed, along with the node identifier used in
2.49 - the original template and output documents to
2.50 - mark a region of those documents as the fragment
2.51 - to be updated upon "in-page" requests
2.52 -
2.53 - * init_resources - a dictionary mapping initialiser/input
2.54 - identifiers to (template_filename,
2.55 - input_filename) tuples, indicating the template
2.56 - and initialiser/input stylesheet filenames to be
2.57 - employed
2.58 -
2.59 - * transform_resources - a dictionary mapping transform identifiers to
2.60 - lists of stylesheet filenames for use with the
2.61 - transformation methods
2.62 -
2.63 - * document_resources - a dictionary mapping document identifiers to
2.64 - single filenames for use as source documents or
2.65 - as references with the transformation methods
2.66 -
2.67 - * resource_dir - the absolute path of the directory in which
2.68 - stylesheet resources are to reside
2.69 -
2.70 - All filenames shall be simple leafnames for files residing in the resource's
2.71 - special resource directory 'resource_dir'.
2.72 -
2.73 - The following attributes may also be specified:
2.74 -
2.75 - * path_encoding - the assumed encoding of characters in request
2.76 - paths
2.77 -
2.78 - * encoding - the assumed encoding of characters in request
2.79 - bodies
2.80 - """
2.81 -
2.82 - path_encoding = "utf-8"
2.83 - encoding = "utf-8"
2.84 - template_resources = {}
2.85 - in_page_resources = {}
2.86 - transform_resources = {}
2.87 - document_resources = {}
2.88 - resource_dir = None
2.89 -
2.90 - def clean_parameters(self, parameters):
2.91 -
2.92 - """
2.93 - Workaround stray zero value characters from Konqueror in XMLHttpRequest
2.94 - communications.
2.95 - """
2.96 -
2.97 - for name, values in parameters.items():
2.98 - new_values = []
2.99 - for value in values:
2.100 - if value.endswith("\x00"):
2.101 - new_values.append(value[:-1])
2.102 - else:
2.103 - new_values.append(value)
2.104 - parameters[name] = new_values
2.105 -
2.106 - def prepare_output(self, output_identifier):
2.107 -
2.108 - """
2.109 - Prepare the output stylesheets using the given 'output_identifier' to
2.110 - indicate which templates and stylesheets are to be employed in the
2.111 - production of output from the resource.
2.112 -
2.113 - The 'output_identifier' is used as a key to the 'template_resources'
2.114 - dictionary attribute.
2.115 -
2.116 - Return the full path to the output stylesheet for use with 'send_output'
2.117 - or 'get_result'.
2.118 - """
2.119 -
2.120 - template_filename, output_filename = self.template_resources[output_identifier]
2.121 - output_path = os.path.abspath(os.path.join(self.resource_dir, output_filename))
2.122 - template_path = os.path.abspath(os.path.join(self.resource_dir, template_filename))
2.123 - XSLForms.Prepare.ensure_stylesheet(template_path, output_path)
2.124 - return output_path
2.125 -
2.126 - def prepare_fragment(self, output_identifier, fragment_identifier):
2.127 -
2.128 - """
2.129 - Prepare the output stylesheets for the given 'output_identifier' and
2.130 - 'fragment_identifier', indicating which templates and stylesheets are to
2.131 - be employed in the production of output from the resource.
2.132 -
2.133 - The 'output_identifier' is used as a key to the 'template_resources'
2.134 - dictionary attribute; the 'fragment_identifier' is used as a key to the
2.135 - 'in_page_resources' dictionary attribute.
2.136 -
2.137 - Return the full path to the output stylesheet for use with 'send_output'
2.138 - or 'get_result'.
2.139 - """
2.140 -
2.141 - output_path = self.prepare_output(output_identifier)
2.142 - fragment_filename, node_identifier = self.in_page_resources[fragment_identifier]
2.143 - fragment_path = os.path.abspath(os.path.join(self.resource_dir, fragment_filename))
2.144 - XSLForms.Prepare.ensure_stylesheet_fragment(output_path, fragment_path, node_identifier)
2.145 - return fragment_path
2.146 -
2.147 - def prepare_parameters(self, parameters):
2.148 -
2.149 - """
2.150 - Prepare the stylesheet parameters from the given request 'parameters'.
2.151 - This is most useful when preparing fragments for in-page update output.
2.152 - """
2.153 -
2.154 - element_path = parameters.get("element-path", [""])[0]
2.155 - if element_path:
2.156 - return {"element-path" : element_path}
2.157 - else:
2.158 - return {}
2.159 -
2.160 - def send_output(self, trans, stylesheet_filenames, document, stylesheet_parameters=None,
2.161 - stylesheet_expressions=None, references=None):
2.162 -
2.163 - """
2.164 - Send the output from the resource to the user employing the transaction
2.165 - 'trans', stylesheets having the given 'stylesheet_filenames', the
2.166 - 'document' upon which the output will be based, the optional parameters
2.167 - as defined in the 'stylesheet_parameters' dictionary, the optional
2.168 - expressions are defined in the 'stylesheet_expressions' dictionary, and
2.169 - the optional 'references' to external documents.
2.170 - """
2.171 -
2.172 - # Sanity check for the filenames list.
2.173 -
2.174 - if isinstance(stylesheet_filenames, str) or isinstance(stylesheet_filenames, unicode):
2.175 - raise ValueError, stylesheet_filenames
2.176 -
2.177 - proc = XSLOutput.Processor(stylesheet_filenames, parameters=stylesheet_parameters,
2.178 - expressions=stylesheet_expressions, references=references)
2.179 - proc.send_output(trans.get_response_stream(), trans.get_response_stream_encoding(),
2.180 - document)
2.181 -
2.182 - def get_result(self, stylesheet_filenames, document, stylesheet_parameters=None,
2.183 - stylesheet_expressions=None, references=None):
2.184 -
2.185 - """
2.186 - Get the result of applying a transformation using stylesheets with the
2.187 - given 'stylesheet_filenames', the 'document' upon which the result will
2.188 - be based, the optional parameters as defined in the
2.189 - 'stylesheet_parameters' dictionary, the optional parameters as defined
2.190 - in the 'stylesheet_parameters' dictionaryand the optional 'references'
2.191 - to external documents.
2.192 - """
2.193 -
2.194 - # Sanity check for the filenames list.
2.195 -
2.196 - if isinstance(stylesheet_filenames, str) or isinstance(stylesheet_filenames, unicode):
2.197 - raise ValueError, stylesheet_filenames
2.198 -
2.199 - proc = XSLOutput.Processor(stylesheet_filenames, parameters=stylesheet_parameters,
2.200 - expressions=stylesheet_expressions, references=references)
2.201 - return proc.get_result(document)
2.202 -
2.203 - def prepare_initialiser(self, input_identifier):
2.204 -
2.205 - """
2.206 - Prepare an initialiser/input transformation using the given
2.207 - 'input_identifier'.
2.208 -
2.209 - Return the full path to the input stylesheet for use with 'send_output'
2.210 - or 'get_result'.
2.211 - """
2.212 -
2.213 - template_filename, input_filename = self.init_resources[input_identifier]
2.214 - input_path = os.path.abspath(os.path.join(self.resource_dir, input_filename))
2.215 - template_path = os.path.abspath(os.path.join(self.resource_dir, template_filename))
2.216 - XSLForms.Prepare.ensure_input_stylesheet(template_path, input_path)
2.217 - return input_path
2.218 -
2.219 - def prepare_transform(self, transform_identifier):
2.220 -
2.221 - """
2.222 - Prepare a transformation using the given 'transform_identifier'.
2.223 -
2.224 - Return a list of full paths to the output stylesheets for use with
2.225 - 'send_output' or 'get_result'.
2.226 - """
2.227 -
2.228 - filenames = self.transform_resources[transform_identifier]
2.229 - paths = []
2.230 - for filename in filenames:
2.231 - paths.append(os.path.abspath(os.path.join(self.resource_dir, filename)))
2.232 - return paths
2.233 -
2.234 - def prepare_document(self, document_identifier):
2.235 -
2.236 - """
2.237 - Prepare a document using the given 'document_identifier'.
2.238 -
2.239 - Return the full path of the document for use either as the source
2.240 - document or as a reference with 'send_output' or 'get_result'.
2.241 - """
2.242 -
2.243 - filename = self.document_resources[document_identifier]
2.244 - return os.path.abspath(os.path.join(self.resource_dir, filename))
2.245 -
2.246 - def get_in_page_resource(self, trans):
2.247 -
2.248 - """
2.249 - Return the in-page resource being referred to in the given transaction
2.250 - 'trans'.
2.251 - """
2.252 -
2.253 - return trans.get_path_info(self.path_encoding).split("/")[-1]
2.254 -
2.255 - def respond(self, trans):
2.256 -
2.257 - """
2.258 - Respond to the request described by the given transaction 'trans'.
2.259 - """
2.260 -
2.261 - # Only obtain field information according to the stated method.
2.262 -
2.263 - method = trans.get_request_method()
2.264 - in_page_resource = self.get_in_page_resource(trans)
2.265 -
2.266 - # Handle typical request methods, processing request information.
2.267 -
2.268 - if method == "GET":
2.269 -
2.270 - # Get the fields from the request path (URL).
2.271 - # NOTE: The encoding is actually redundant since WebStack produces
2.272 - # NOTE: Unicode values.
2.273 -
2.274 - form = XSLForms.Fields.Form(encoding=self.path_encoding, values_are_lists=1)
2.275 - parameters = trans.get_fields_from_path()
2.276 - form.set_parameters(parameters)
2.277 -
2.278 - elif method == "POST":
2.279 -
2.280 - # Get the fields from the request body.
2.281 - # NOTE: The encoding is actually redundant since WebStack produces
2.282 - # NOTE: Unicode values.
2.283 -
2.284 - form = XSLForms.Fields.Form(encoding=self.encoding, values_are_lists=1)
2.285 - parameters = trans.get_fields_from_body(self.encoding)
2.286 -
2.287 - # NOTE: Konqueror workaround.
2.288 - self.clean_parameters(parameters)
2.289 -
2.290 - form.set_parameters(parameters)
2.291 -
2.292 - else:
2.293 -
2.294 - # Initialise empty containers.
2.295 -
2.296 - parameters = {}
2.297 - documents = {}
2.298 -
2.299 - # Call an overridden method with the processed request information.
2.300 -
2.301 - self.respond_to_form(trans, form)
2.302 -
2.303 - def respond_to_form(self, trans, form):
2.304 -
2.305 - """
2.306 - Respond to the request described by the given transaction 'trans', using
2.307 - the given 'form' object to conveniently retrieve field (request
2.308 - parameter) information and structured form information (as DOM-style XML
2.309 - documents).
2.310 - """
2.311 -
2.312 - trans.set_response_code(500)
2.313 - raise WebStack.Generic.EndOfResponse
2.314 -
2.315 -# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/XSLForms/Resources/PyQtResources.py Wed Oct 26 00:07:09 2005 +0000
3.3 @@ -0,0 +1,114 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +import XSLForms.Prepare
3.7 +import qt
3.8 +import qtui
3.9 +import qtxmldom
3.10 +import os
3.11 +
3.12 +class XSLFormsResource:
3.13 +
3.14 + "An XSLForms resource for use with PyQt."
3.15 +
3.16 + template_resources = {}
3.17 + widget_resources = {}
3.18 + document_resources = {}
3.19 +
3.20 + # Helper methods.
3.21 + # NOTE: Should be moved to a superclass.
3.22 +
3.23 + def prepare_document(self, document_identifier):
3.24 + filename = self.document_resources[document_identifier]
3.25 + return os.path.abspath(os.path.join(self.resource_dir, filename))
3.26 +
3.27 + def get_document(self, document_identifier):
3.28 + return qtxmldom.parse(self.prepare_document(document_identifier))
3.29 +
3.30 + def get_elements(self, document_identifier):
3.31 + doc = self.get_document(document_identifier)
3.32 + return doc.getElementsByTagName(document_identifier + "-enum")
3.33 +
3.34 + def prepare_template(self, template_identifier):
3.35 + filename = self.template_resources[template_identifier]
3.36 + return os.path.abspath(os.path.join(self.resource_dir, filename))
3.37 +
3.38 + def prepare_widget(self, template_identifier, widget_identifier, parent=None):
3.39 + template_path = self.prepare_template(template_identifier)
3.40 + fragment_name, widget_name = self.widget_resources[widget_identifier]
3.41 + fragment_path = os.path.abspath(os.path.join(self.resource_dir, fragment_name))
3.42 + XSLForms.Prepare.ensure_qt_fragment(template_path, fragment_path, widget_name)
3.43 + return qtui.QWidgetFactory.create(fragment_path, None, parent)
3.44 +
3.45 + def populate_list(self, field, elements):
3.46 + current_text = field.currentText()
3.47 + while field.count() > 0:
3.48 + field.removeItem(0)
3.49 + item = 0
3.50 + set = 0
3.51 + for element in elements:
3.52 + text = element.getAttribute("value")
3.53 + field.insertItem(text)
3.54 + if text == current_text:
3.55 + field.setCurrentItem(item)
3.56 + set = 1
3.57 + item += 1
3.58 + if not set:
3.59 + field.setCurrentItem(0)
3.60 +
3.61 + def reset_collection(self, field):
3.62 + layout = field.layout()
3.63 + for child in field.children():
3.64 + if child is not layout:
3.65 + layout.remove(child)
3.66 + child.deleteLater()
3.67 +
3.68 +class Factory:
3.69 +
3.70 + "A widget factory helper class."
3.71 +
3.72 + def __init__(self, ui_filename):
3.73 + self.ui_filename = ui_filename
3.74 + self.ui_doc = qtxmldom.parse(ui_filename)
3.75 +
3.76 + def connect(self, widget, obj):
3.77 +
3.78 + for connection in self.ui_doc.getElementsByTagName("connection"):
3.79 + sender_name = self.get_text(connection.getElementsByTagName("sender")[0]).encode("utf-8")
3.80 + signal_name = self.get_text(connection.getElementsByTagName("signal")[0]).encode("utf-8")
3.81 + slot_name = self.get_text(connection.getElementsByTagName("slot")[0]).encode("utf-8")
3.82 +
3.83 + if widget.name() == sender_name:
3.84 + senders = [widget]
3.85 + else:
3.86 + senders = self.find_widgets(widget, sender_name)
3.87 +
3.88 + slot = slot_name.split("(")[0]
3.89 + if hasattr(obj, slot):
3.90 + signal = qt.SIGNAL(signal_name)
3.91 + for sender in senders:
3.92 + qt.QObject.connect(sender, signal, getattr(obj, slot))
3.93 +
3.94 + def find_widgets(self, widget, name):
3.95 + widgets = []
3.96 + found = widget.child(name)
3.97 + if found:
3.98 + widgets.append(found)
3.99 + for child in widget.children():
3.100 + widgets += self.find_widgets(child, name)
3.101 + return widgets
3.102 +
3.103 + def get_text(self, node):
3.104 + node.normalize()
3.105 + return node.childNodes[0].nodeValue
3.106 +
3.107 + def find_widget_element(self, name):
3.108 + for widget in self.ui_doc.getElementsByTagName("widget"):
3.109 + for property in widget.getElementsByTagName("property"):
3.110 + if property.getAttribute("name") == "name":
3.111 + for cstring in property.getElementsByTagName("cstring"):
3.112 + found_name = self.get_text(cstring)
3.113 + if found_name == name:
3.114 + return widget
3.115 + return None
3.116 +
3.117 +# vim: tabstop=4 expandtab shiftwidth=4
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/XSLForms/Resources/WebResources.py Wed Oct 26 00:07:09 2005 +0000
4.3 @@ -0,0 +1,312 @@
4.4 +#!/usr/bin/env python
4.5 +
4.6 +"""
4.7 +Resources for use with WebStack.
4.8 +
4.9 +Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
4.10 +
4.11 +This library is free software; you can redistribute it and/or
4.12 +modify it under the terms of the GNU Lesser General Public
4.13 +License as published by the Free Software Foundation; either
4.14 +version 2.1 of the License, or (at your option) any later version.
4.15 +
4.16 +This library is distributed in the hope that it will be useful,
4.17 +but WITHOUT ANY WARRANTY; without even the implied warranty of
4.18 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4.19 +Lesser General Public License for more details.
4.20 +
4.21 +You should have received a copy of the GNU Lesser General Public
4.22 +License along with this library; if not, write to the Free Software
4.23 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4.24 +"""
4.25 +
4.26 +import WebStack.Generic
4.27 +import XSLForms.Fields
4.28 +import XSLForms.Prepare
4.29 +import XSLForms.Output
4.30 +from XSLTools import XSLOutput
4.31 +import os
4.32 +
4.33 +class XSLFormsResource:
4.34 +
4.35 + """
4.36 + A generic XSLForms resource for use with WebStack.
4.37 +
4.38 + When overriding this class, define the following attributes appropriately:
4.39 +
4.40 + * template_resources - a dictionary mapping output identifiers to
4.41 + (template_filename, output_filename) tuples,
4.42 + indicating the template and stylesheet filenames
4.43 + to be employed
4.44 +
4.45 + * in_page_resources - a dictionary mapping fragment identifiers to
4.46 + (output_filename, node_identifier) tuples,
4.47 + indicating the stylesheet filename to be
4.48 + employed, along with the node identifier used in
4.49 + the original template and output documents to
4.50 + mark a region of those documents as the fragment
4.51 + to be updated upon "in-page" requests
4.52 +
4.53 + * init_resources - a dictionary mapping initialiser/input
4.54 + identifiers to (template_filename,
4.55 + input_filename) tuples, indicating the template
4.56 + and initialiser/input stylesheet filenames to be
4.57 + employed
4.58 +
4.59 + * transform_resources - a dictionary mapping transform identifiers to
4.60 + lists of stylesheet filenames for use with the
4.61 + transformation methods
4.62 +
4.63 + * document_resources - a dictionary mapping document identifiers to
4.64 + single filenames for use as source documents or
4.65 + as references with the transformation methods
4.66 +
4.67 + * resource_dir - the absolute path of the directory in which
4.68 + stylesheet resources are to reside
4.69 +
4.70 + All filenames shall be simple leafnames for files residing in the resource's
4.71 + special resource directory 'resource_dir'.
4.72 +
4.73 + The following attributes may also be specified:
4.74 +
4.75 + * path_encoding - the assumed encoding of characters in request
4.76 + paths
4.77 +
4.78 + * encoding - the assumed encoding of characters in request
4.79 + bodies
4.80 + """
4.81 +
4.82 + path_encoding = "utf-8"
4.83 + encoding = "utf-8"
4.84 + template_resources = {}
4.85 + in_page_resources = {}
4.86 + transform_resources = {}
4.87 + document_resources = {}
4.88 + resource_dir = None
4.89 +
4.90 + def clean_parameters(self, parameters):
4.91 +
4.92 + """
4.93 + Workaround stray zero value characters from Konqueror in XMLHttpRequest
4.94 + communications.
4.95 + """
4.96 +
4.97 + for name, values in parameters.items():
4.98 + new_values = []
4.99 + for value in values:
4.100 + if value.endswith("\x00"):
4.101 + new_values.append(value[:-1])
4.102 + else:
4.103 + new_values.append(value)
4.104 + parameters[name] = new_values
4.105 +
4.106 + def prepare_output(self, output_identifier):
4.107 +
4.108 + """
4.109 + Prepare the output stylesheets using the given 'output_identifier' to
4.110 + indicate which templates and stylesheets are to be employed in the
4.111 + production of output from the resource.
4.112 +
4.113 + The 'output_identifier' is used as a key to the 'template_resources'
4.114 + dictionary attribute.
4.115 +
4.116 + Return the full path to the output stylesheet for use with 'send_output'
4.117 + or 'get_result'.
4.118 + """
4.119 +
4.120 + template_filename, output_filename = self.template_resources[output_identifier]
4.121 + output_path = os.path.abspath(os.path.join(self.resource_dir, output_filename))
4.122 + template_path = os.path.abspath(os.path.join(self.resource_dir, template_filename))
4.123 + XSLForms.Prepare.ensure_stylesheet(template_path, output_path)
4.124 + return output_path
4.125 +
4.126 + def prepare_fragment(self, output_identifier, fragment_identifier):
4.127 +
4.128 + """
4.129 + Prepare the output stylesheets for the given 'output_identifier' and
4.130 + 'fragment_identifier', indicating which templates and stylesheets are to
4.131 + be employed in the production of output from the resource.
4.132 +
4.133 + The 'output_identifier' is used as a key to the 'template_resources'
4.134 + dictionary attribute; the 'fragment_identifier' is used as a key to the
4.135 + 'in_page_resources' dictionary attribute.
4.136 +
4.137 + Return the full path to the output stylesheet for use with 'send_output'
4.138 + or 'get_result'.
4.139 + """
4.140 +
4.141 + output_path = self.prepare_output(output_identifier)
4.142 + fragment_filename, node_identifier = self.in_page_resources[fragment_identifier]
4.143 + fragment_path = os.path.abspath(os.path.join(self.resource_dir, fragment_filename))
4.144 + XSLForms.Prepare.ensure_stylesheet_fragment(output_path, fragment_path, node_identifier)
4.145 + return fragment_path
4.146 +
4.147 + def prepare_parameters(self, parameters):
4.148 +
4.149 + """
4.150 + Prepare the stylesheet parameters from the given request 'parameters'.
4.151 + This is most useful when preparing fragments for in-page update output.
4.152 + """
4.153 +
4.154 + element_path = parameters.get("element-path", [""])[0]
4.155 + if element_path:
4.156 + return {"element-path" : element_path}
4.157 + else:
4.158 + return {}
4.159 +
4.160 + def send_output(self, trans, stylesheet_filenames, document, stylesheet_parameters=None,
4.161 + stylesheet_expressions=None, references=None):
4.162 +
4.163 + """
4.164 + Send the output from the resource to the user employing the transaction
4.165 + 'trans', stylesheets having the given 'stylesheet_filenames', the
4.166 + 'document' upon which the output will be based, the optional parameters
4.167 + as defined in the 'stylesheet_parameters' dictionary, the optional
4.168 + expressions are defined in the 'stylesheet_expressions' dictionary, and
4.169 + the optional 'references' to external documents.
4.170 + """
4.171 +
4.172 + # Sanity check for the filenames list.
4.173 +
4.174 + if isinstance(stylesheet_filenames, str) or isinstance(stylesheet_filenames, unicode):
4.175 + raise ValueError, stylesheet_filenames
4.176 +
4.177 + proc = XSLOutput.Processor(stylesheet_filenames, parameters=stylesheet_parameters,
4.178 + expressions=stylesheet_expressions, references=references)
4.179 + proc.send_output(trans.get_response_stream(), trans.get_response_stream_encoding(),
4.180 + document)
4.181 +
4.182 + def get_result(self, stylesheet_filenames, document, stylesheet_parameters=None,
4.183 + stylesheet_expressions=None, references=None):
4.184 +
4.185 + """
4.186 + Get the result of applying a transformation using stylesheets with the
4.187 + given 'stylesheet_filenames', the 'document' upon which the result will
4.188 + be based, the optional parameters as defined in the
4.189 + 'stylesheet_parameters' dictionary, the optional parameters as defined
4.190 + in the 'stylesheet_parameters' dictionaryand the optional 'references'
4.191 + to external documents.
4.192 + """
4.193 +
4.194 + # Sanity check for the filenames list.
4.195 +
4.196 + if isinstance(stylesheet_filenames, str) or isinstance(stylesheet_filenames, unicode):
4.197 + raise ValueError, stylesheet_filenames
4.198 +
4.199 + proc = XSLOutput.Processor(stylesheet_filenames, parameters=stylesheet_parameters,
4.200 + expressions=stylesheet_expressions, references=references)
4.201 + return proc.get_result(document)
4.202 +
4.203 + def prepare_initialiser(self, input_identifier):
4.204 +
4.205 + """
4.206 + Prepare an initialiser/input transformation using the given
4.207 + 'input_identifier'.
4.208 +
4.209 + Return the full path to the input stylesheet for use with 'send_output'
4.210 + or 'get_result'.
4.211 + """
4.212 +
4.213 + template_filename, input_filename = self.init_resources[input_identifier]
4.214 + input_path = os.path.abspath(os.path.join(self.resource_dir, input_filename))
4.215 + template_path = os.path.abspath(os.path.join(self.resource_dir, template_filename))
4.216 + XSLForms.Prepare.ensure_input_stylesheet(template_path, input_path)
4.217 + return input_path
4.218 +
4.219 + def prepare_transform(self, transform_identifier):
4.220 +
4.221 + """
4.222 + Prepare a transformation using the given 'transform_identifier'.
4.223 +
4.224 + Return a list of full paths to the output stylesheets for use with
4.225 + 'send_output' or 'get_result'.
4.226 + """
4.227 +
4.228 + filenames = self.transform_resources[transform_identifier]
4.229 + paths = []
4.230 + for filename in filenames:
4.231 + paths.append(os.path.abspath(os.path.join(self.resource_dir, filename)))
4.232 + return paths
4.233 +
4.234 + def prepare_document(self, document_identifier):
4.235 +
4.236 + """
4.237 + Prepare a document using the given 'document_identifier'.
4.238 +
4.239 + Return the full path of the document for use either as the source
4.240 + document or as a reference with 'send_output' or 'get_result'.
4.241 + """
4.242 +
4.243 + filename = self.document_resources[document_identifier]
4.244 + return os.path.abspath(os.path.join(self.resource_dir, filename))
4.245 +
4.246 + def get_in_page_resource(self, trans):
4.247 +
4.248 + """
4.249 + Return the in-page resource being referred to in the given transaction
4.250 + 'trans'.
4.251 + """
4.252 +
4.253 + return trans.get_path_info(self.path_encoding).split("/")[-1]
4.254 +
4.255 + def respond(self, trans):
4.256 +
4.257 + """
4.258 + Respond to the request described by the given transaction 'trans'.
4.259 + """
4.260 +
4.261 + # Only obtain field information according to the stated method.
4.262 +
4.263 + method = trans.get_request_method()
4.264 + in_page_resource = self.get_in_page_resource(trans)
4.265 +
4.266 + # Handle typical request methods, processing request information.
4.267 +
4.268 + if method == "GET":
4.269 +
4.270 + # Get the fields from the request path (URL).
4.271 + # NOTE: The encoding is actually redundant since WebStack produces
4.272 + # NOTE: Unicode values.
4.273 +
4.274 + form = XSLForms.Fields.Form(encoding=self.path_encoding, values_are_lists=1)
4.275 + parameters = trans.get_fields_from_path()
4.276 + form.set_parameters(parameters)
4.277 +
4.278 + elif method == "POST":
4.279 +
4.280 + # Get the fields from the request body.
4.281 + # NOTE: The encoding is actually redundant since WebStack produces
4.282 + # NOTE: Unicode values.
4.283 +
4.284 + form = XSLForms.Fields.Form(encoding=self.encoding, values_are_lists=1)
4.285 + parameters = trans.get_fields_from_body(self.encoding)
4.286 +
4.287 + # NOTE: Konqueror workaround.
4.288 + self.clean_parameters(parameters)
4.289 +
4.290 + form.set_parameters(parameters)
4.291 +
4.292 + else:
4.293 +
4.294 + # Initialise empty containers.
4.295 +
4.296 + parameters = {}
4.297 + documents = {}
4.298 +
4.299 + # Call an overridden method with the processed request information.
4.300 +
4.301 + self.respond_to_form(trans, form)
4.302 +
4.303 + def respond_to_form(self, trans, form):
4.304 +
4.305 + """
4.306 + Respond to the request described by the given transaction 'trans', using
4.307 + the given 'form' object to conveniently retrieve field (request
4.308 + parameter) information and structured form information (as DOM-style XML
4.309 + documents).
4.310 + """
4.311 +
4.312 + trans.set_response_code(500)
4.313 + raise WebStack.Generic.EndOfResponse
4.314 +
4.315 +# vim: tabstop=4 expandtab shiftwidth=4
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/XSLForms/Resources/__init__.py Wed Oct 26 00:07:09 2005 +0000
5.3 @@ -0,0 +1,23 @@
5.4 +#!/usr/bin/env python
5.5 +
5.6 +"""
5.7 +XML/XSL-based forms resource classes.
5.8 +
5.9 +Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk>
5.10 +
5.11 +This library is free software; you can redistribute it and/or
5.12 +modify it under the terms of the GNU Lesser General Public
5.13 +License as published by the Free Software Foundation; either
5.14 +version 2.1 of the License, or (at your option) any later version.
5.15 +
5.16 +This library is distributed in the hope that it will be useful,
5.17 +but WITHOUT ANY WARRANTY; without even the implied warranty of
5.18 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5.19 +Lesser General Public License for more details.
5.20 +
5.21 +You should have received a copy of the GNU Lesser General Public
5.22 +License along with this library; if not, write to the Free Software
5.23 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5.24 +"""
5.25 +
5.26 +# vim: tabstop=4 expandtab shiftwidth=4
6.1 --- a/docs/Web-resource.html Tue Oct 25 17:52:28 2005 +0000
6.2 +++ b/docs/Web-resource.html Wed Oct 26 00:07:09 2005 +0000
6.3 @@ -20,14 +20,14 @@
6.4 earlier, we now want to edit the <code>__init__.py</code> file and
6.5 add code which will do most of the work of the form-editing
6.6 application. Here is the start of this code:</p>
6.7 -<pre>#!/usr/bin/env python<br /><br />"A very simple example application."<br /><br />import WebStack.Generic<br />import XSLForms.Resources<br />import XSLForms.Utils<br />import os<br /><br /># Resource classes.<br /><br />class VerySimpleResource(XSLForms.Resources.XSLFormsResource):<br /><br /> # To be continued.</pre>
6.8 +<pre>#!/usr/bin/env python<br /><br />"A very simple example application."<br /><br />import WebStack.Generic<br />import XSLForms.Resources.WebResources<br />import XSLForms.Utils<br />import os<br /><br /># Resource classes.<br /><br />class VerySimpleResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> # To be continued.</pre>
6.9 <p>The above import statements just include in our application
6.10 everything that it is likely to need from WebStack, XSLForms and the
6.11 standard library. Then, we define a class inheriting from a special
6.12 XSLForms class which does some of the tedious Web application
6.13 housekeeping that we would otherwise need to do ourselves.</p>
6.14 <p>We may expand the above class definition as follows:</p>
6.15 -<pre>class VerySimpleResource(XSLForms.Resources.XSLFormsResource):<br /><br /> "A very simple resource providing a hierarchy of editable fields."<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")<br /> encoding = "utf-8"<br /> template_resources = {<br /> "structure" : ("structure_template.xhtml", "structure_output.xsl")<br /> }<br /><br /> def respond_to_form(self, trans, form):<br /><br /> """<br /> Respond to a request having the given transaction 'trans' and the given<br /> 'form' information.<br /> """<br /><br /> # To be continued.</pre>
6.16 +<pre>class VerySimpleResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> "A very simple resource providing a hierarchy of editable fields."<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")<br /> encoding = "utf-8"<br /> template_resources = {<br /> "structure" : ("structure_template.xhtml", "structure_output.xsl")<br /> }<br /><br /> def respond_to_form(self, trans, form):<br /><br /> """<br /> Respond to a request having the given transaction 'trans' and the given<br /> 'form' information.<br /> """<br /><br /> # To be continued.</pre>
6.17 <p>The class is started with some attribute definitions:</p>
6.18 <ul>
6.19 <li>The <code>resource_dir</code> attribute is used to locate
6.20 @@ -132,4 +132,4 @@
6.21 using the usual WebStack techniques. However, more advanced templates
6.22 can be designed, and we shall consider <a href="multiple.html">multiple-choice
6.23 fields</a> in the next activity in the development <a href="overview.html">process</a>.</p>
6.24 -</body></html>
6.25 \ No newline at end of file
6.26 +</body></html>
7.1 --- a/docs/XSLForms-resource.html Tue Oct 25 17:52:28 2005 +0000
7.2 +++ b/docs/XSLForms-resource.html Wed Oct 26 00:07:09 2005 +0000
7.3 @@ -11,7 +11,7 @@
7.4 from this class, <code>XSLFormsResource</code>,
7.5 you can derive your own application-specific resources and use the
7.6 class's API to obtain, manipulate and present form data. Although the
7.7 -supplied <a href="../apidocs/index.html">API documentation</a> provides details of the class's API, specifically in the <code><a href="../apidocs/public/XSLForms.Resources-module.html">XSLForms.Resources</a></code><a href="../apidocs/public/XSLForms.Resources-module.html"></a> module, this document attempts to explain how the API is used in practice.</p><h2>Resource Structure</h2><p>The structure of a Web resource derived from <code>XSLFormsResource</code> should look like this:</p><pre>class MyResource(XSLForms.Resources.XSLFormsResource):<br /><br /> [Resource definitions]<br /><br /> def respond_to_form(self, trans, form):<br /> [Examine the form data, see if the user has added or removed anything.]<br /> [Perform additional processing and initialise the form data.]<br /> [Produce some kind of response to show the user the updated form data.]</pre><p>Since <code>XSLFormsResource</code> builds on WebStack's resource mechanisms, we do have the transaction object, <code>trans</code>, available. However, most of the information we need to access and manipulate is generally available through the <code>form</code> object.</p><h2>Defining Resources</h2><p>Classes derived from <code>XSLFormsResource</code>
7.8 +supplied <a href="../apidocs/index.html">API documentation</a> provides details of the class's API, specifically in the <code><a href="../apidocs/public/XSLForms.Resources.WebResources-module.html">XSLForms.Resources.WebResources</a></code><a href="../apidocs/public/XSLForms.Resources.WebResources-module.html"></a> module, this document attempts to explain how the API is used in practice.</p><h2>Resource Structure</h2><p>The structure of a Web resource derived from <code>XSLFormsResource</code> should look like this:</p><pre>class MyResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> [Resource definitions]<br /><br /> def respond_to_form(self, trans, form):<br /> [Examine the form data, see if the user has added or removed anything.]<br /> [Perform additional processing and initialise the form data.]<br /> [Produce some kind of response to show the user the updated form data.]</pre><p>Since <code>XSLFormsResource</code> builds on WebStack's resource mechanisms, we do have the transaction object, <code>trans</code>, available. However, most of the information we need to access and manipulate is generally available through the <code>form</code> object.</p><h2>Defining Resources</h2><p>Classes derived from <code>XSLFormsResource</code>
7.9 support the concept of resources which are used to produce output,
7.10 support processing and to provide access to useful information. At the
7.11 class level it is essential to define at least some of these resources
7.12 @@ -19,7 +19,7 @@
7.13 XSLForms relies on template files residing in the filesystem, along
7.14 with other files, we need to define where such files can be found (as
7.15 described in the <a href="directory.html">"Creating Applications: Create
7.16 -a Directory"</a> document). Consequently, it is the convention that all resource classes define such information as follows:</p><pre>class ConfiguratorResource(XSLForms.Resources.XSLFormsResource):<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")</pre><p>All
7.17 +a Directory"</a> document). Consequently, it is the convention that all resource classes define such information as follows:</p><pre>class ConfiguratorResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")</pre><p>All
7.18 filenames, defined in the various resource sections (as described
7.19 below) must be stated without leading path information - in other
7.20 words, as "leafnames" rather than "pathnames". Thus, an example of
7.21 @@ -204,4 +204,4 @@
7.22 enough flexibility when introducing additional information into a
7.23 transformation. An alternative approach involves copying data into the
7.24 document to be processed and then to supply references to the data in
7.25 -its new location within the document.</p></body></html>
7.26 \ No newline at end of file
7.27 +its new location within the document.</p></body></html>
8.1 --- a/docs/in-page-updates.html Tue Oct 25 17:52:28 2005 +0000
8.2 +++ b/docs/in-page-updates.html Wed Oct 26 00:07:09 2005 +0000
8.3 @@ -169,10 +169,10 @@
8.4 pages from our application. Some standard WebStack resources can be
8.5 used to help with this, and we add some imports at the top of our
8.6 source file:</p>
8.7 -<pre>#!/usr/bin/env python<br /><br />"A very simple example application."<br /><br />import WebStack.Generic<br />import XSLForms.Resources<br />import XSLForms.Utils<br />import os<br /><br /><span style="font-weight: bold;"># Site map imports.</span><br style="font-weight: bold;" /><br style="font-weight: bold;" /><span style="font-weight: bold;">from WebStack.Resources.ResourceMap import MapResource</span><br style="font-weight: bold;" /><span style="font-weight: bold;">from WebStack.Resources.Static import DirectoryResource</span></pre>
8.8 +<pre>#!/usr/bin/env python<br /><br />"A very simple example application."<br /><br />import WebStack.Generic<br />import XSLForms.Resources.WebResources<br />import XSLForms.Utils<br />import os<br /><br /><span style="font-weight: bold;"># Site map imports.</span><br style="font-weight: bold;" /><br style="font-weight: bold;" /><span style="font-weight: bold;">from WebStack.Resources.ResourceMap import MapResource</span><br style="font-weight: bold;" /><span style="font-weight: bold;">from WebStack.Resources.Static import DirectoryResource</span></pre>
8.9 <p>Then, we define the resource class as <a href="Web-resource.html">before</a>,
8.10 but with an additional attribute:</p>
8.11 -<pre># Resource classes.<br /><br />class VerySimpleResource(XSLForms.Resources.XSLFormsResource):<br /><br /> "A very simple resource providing a hierarchy of editable fields."<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")<br /> encoding = "utf-8"<br /> template_resources = {<br /> "structure" : ("structure_multivalue_template.xhtml", "structure_output.xsl")<br /> }<br /> init_resources = {<br /> "structure" : ("structure_multivalue_template.xhtml", "structure_input.xsl")<br /> }<br /> transform_resources = {<br /> "comments" : ["structure_comments.xsl"]<br /> }<br /> document_resources = {<br /> "types" : "structure_types.xml"<br /> }<br /><span style="font-weight: bold;"> in_page_resources = {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> "comments" : ("structure_output_comments.xsl", "comment-node")</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span></pre>
8.12 +<pre># Resource classes.<br /><br />class VerySimpleResource(XSLForms.Resources.WebResources.XSLFormsResource):<br /><br /> "A very simple resource providing a hierarchy of editable fields."<br /><br /> resource_dir = os.path.join(os.path.split(__file__)[0], "Resources")<br /> encoding = "utf-8"<br /> template_resources = {<br /> "structure" : ("structure_multivalue_template.xhtml", "structure_output.xsl")<br /> }<br /> init_resources = {<br /> "structure" : ("structure_multivalue_template.xhtml", "structure_input.xsl")<br /> }<br /> transform_resources = {<br /> "comments" : ["structure_comments.xsl"]<br /> }<br /> document_resources = {<br /> "types" : "structure_types.xml"<br /> }<br /><span style="font-weight: bold;"> in_page_resources = {</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> "comments" : ("structure_output_comments.xsl", "comment-node")</span><br style="font-weight: bold;" /><span style="font-weight: bold;"> }</span></pre>
8.13 <p>This new attribute provides information about the in-page request to
8.14 retrieve comment regions of the Web form, and it consists of the
8.15 stylesheet filename that will be generated to produce the page
8.16 @@ -220,4 +220,4 @@
8.17 script file; otherwise it gets a Web page showing either all of the
8.18 form (if a normal request is received), or a part of the form (if an
8.19 in-page request is received).</p>
8.20 -</body></html>
8.21 \ No newline at end of file
8.22 +</body></html>
9.1 --- a/examples/Common/Candidate/__init__.py Tue Oct 25 17:52:28 2005 +0000
9.2 +++ b/examples/Common/Candidate/__init__.py Wed Oct 26 00:07:09 2005 +0000
9.3 @@ -3,7 +3,7 @@
9.4 "A job candidate editing application."
9.5
9.6 import WebStack.Generic
9.7 -import XSLForms.Resources
9.8 +import XSLForms.Resources.WebResources
9.9 import XSLForms.Utils
9.10 import os
9.11
9.12 @@ -14,7 +14,7 @@
9.13
9.14 # Resource classes.
9.15
9.16 -class CandidateResource(XSLForms.Resources.XSLFormsResource):
9.17 +class CandidateResource(XSLForms.Resources.WebResources.XSLFormsResource):
9.18
9.19 "A resource providing editing facilities for a job candidate profile."
9.20
10.1 --- a/examples/Common/Configurator/__init__.py Tue Oct 25 17:52:28 2005 +0000
10.2 +++ b/examples/Common/Configurator/__init__.py Wed Oct 26 00:07:09 2005 +0000
10.3 @@ -4,7 +4,7 @@
10.4
10.5 import WebStack.Generic
10.6 import XSLForms.Utils
10.7 -import XSLForms.Resources
10.8 +import XSLForms.Resources.WebResources
10.9 import os
10.10
10.11 # Site map imports.
10.12 @@ -14,7 +14,7 @@
10.13
10.14 # Resource classes.
10.15
10.16 -class ConfiguratorResource(XSLForms.Resources.XSLFormsResource):
10.17 +class ConfiguratorResource(XSLForms.Resources.WebResources.XSLFormsResource):
10.18
10.19 "A resource providing a system configurator."
10.20
11.1 --- a/examples/Common/Dictionary/__init__.py Tue Oct 25 17:52:28 2005 +0000
11.2 +++ b/examples/Common/Dictionary/__init__.py Wed Oct 26 00:07:09 2005 +0000
11.3 @@ -3,7 +3,7 @@
11.4 "A dictionary example application."
11.5
11.6 import WebStack.Generic
11.7 -import XSLForms.Resources
11.8 +import XSLForms.Resources.WebResources
11.9 import XSLForms.Utils
11.10 import os
11.11
11.12 @@ -14,7 +14,7 @@
11.13
11.14 # Resource classes.
11.15
11.16 -class DictionaryResource(XSLForms.Resources.XSLFormsResource):
11.17 +class DictionaryResource(XSLForms.Resources.WebResources.XSLFormsResource):
11.18
11.19 "A simple resource providing dictionary lookup."
11.20
12.1 --- a/examples/Common/PEP241/__init__.py Tue Oct 25 17:52:28 2005 +0000
12.2 +++ b/examples/Common/PEP241/__init__.py Wed Oct 26 00:07:09 2005 +0000
12.3 @@ -3,7 +3,7 @@
12.4 "A WebStack application for a PEP 241 repository."
12.5
12.6 import WebStack.Generic
12.7 -import XSLForms.Resources
12.8 +import XSLForms.Resources.WebResources
12.9 import XSLForms.Utils
12.10 import os
12.11
12.12 @@ -14,7 +14,7 @@
12.13
12.14 # Resource classes.
12.15
12.16 -class PEP241Resource(XSLForms.Resources.XSLFormsResource):
12.17 +class PEP241Resource(XSLForms.Resources.WebResources.XSLFormsResource):
12.18
12.19 "A resource providing repository browsing."
12.20
13.1 --- a/examples/Common/QtConfigurator/__init__.py Tue Oct 25 17:52:28 2005 +0000
13.2 +++ b/examples/Common/QtConfigurator/__init__.py Wed Oct 26 00:07:09 2005 +0000
13.3 @@ -169,16 +169,16 @@
13.4 def get_resource_class(resource_type):
13.5
13.6 if resource_type == "PyQt":
13.7 - import XSLForms.PyQt
13.8 + import XSLForms.Resources.PyQtResources
13.9 import QtConfigurator.Forms
13.10 - class Configurator(ConfiguratorResource, QtConfigurator.Forms.Configurator, XSLForms.PyQt.XSLFormsResource):
13.11 + class Configurator(ConfiguratorResource, QtConfigurator.Forms.Configurator, XSLForms.Resources.PyQtResources.XSLFormsResource):
13.12 def __init__(self, *args, **kw):
13.13 QtConfigurator.Forms.Configurator.__init__(self, *args, **kw)
13.14 - self.factory = XSLForms.PyQt.Factory(self.prepare_template("configuration"))
13.15 + self.factory = XSLForms.Resources.PyQtResources.Factory(self.prepare_template("configuration"))
13.16 ConfiguratorResource.__init__(self, *args, **kw)
13.17 else:
13.18 - import XSLForms.Resources
13.19 - class Configurator(ConfiguratorResource, XSLForms.PyQtWeb.XSLFormsResource):
13.20 + import XSLForms.Resources.PyQtWebResources
13.21 + class Configurator(ConfiguratorResource, XSLForms.Resources.PyQtWebResources.XSLFormsResource):
13.22 def __init__(self, *args, **kw):
13.23 ConfiguratorResource.__init__(self, *args, **kw)
13.24
14.1 --- a/examples/Common/Questionnaire/__init__.py Tue Oct 25 17:52:28 2005 +0000
14.2 +++ b/examples/Common/Questionnaire/__init__.py Wed Oct 26 00:07:09 2005 +0000
14.3 @@ -3,7 +3,7 @@
14.4 "A WebStack questionnaire application."
14.5
14.6 import WebStack.Generic
14.7 -import XSLForms.Resources
14.8 +import XSLForms.Resources.WebResources
14.9 import XSLForms.Utils
14.10 import os
14.11
14.12 @@ -14,7 +14,7 @@
14.13
14.14 # Resource classes.
14.15
14.16 -class QuestionnaireEditorResource(XSLForms.Resources.XSLFormsResource):
14.17 +class QuestionnaireEditorResource(XSLForms.Resources.WebResources.XSLFormsResource):
14.18
14.19 "A resource providing a questionnaire editor."
14.20
15.1 --- a/examples/Common/VerySimple/__init__.py Tue Oct 25 17:52:28 2005 +0000
15.2 +++ b/examples/Common/VerySimple/__init__.py Wed Oct 26 00:07:09 2005 +0000
15.3 @@ -3,7 +3,7 @@
15.4 "A very simple example application."
15.5
15.6 import WebStack.Generic
15.7 -import XSLForms.Resources
15.8 +import XSLForms.Resources.WebResources
15.9 import XSLForms.Utils
15.10 import os
15.11
15.12 @@ -14,7 +14,7 @@
15.13
15.14 # Resource classes.
15.15
15.16 -class VerySimpleResource(XSLForms.Resources.XSLFormsResource):
15.17 +class VerySimpleResource(XSLForms.Resources.WebResources.XSLFormsResource):
15.18
15.19 "A very simple resource providing a hierarchy of editable fields."
15.20