1.1 --- a/XSLForms/Fields.py Tue Dec 21 00:46:33 2004 +0000
1.2 +++ b/XSLForms/Fields.py Tue Dec 21 19:23:16 2004 +0000
1.3 @@ -27,6 +27,7 @@
1.4 _action_add_animal=/zoo#1/cage#2
1.5 """
1.6
1.7 +import Constants
1.8 import libxml2dom
1.9 from xml.dom import EMPTY_NAMESPACE
1.10
1.11 @@ -40,10 +41,6 @@
1.12 instance documents.
1.13 """
1.14
1.15 - _path_separator = "/"
1.16 - _pair_separator = "#"
1.17 - _selector_indicator = "="
1.18 -
1.19 def __init__(self, encoding="utf-8", values_are_lists=0):
1.20
1.21 """
1.22 @@ -69,7 +66,7 @@
1.23
1.24 # Ignore selectors.
1.25
1.26 - if field.find(self._selector_indicator) != -1:
1.27 + if field.find(Constants.selector_indicator) != -1:
1.28 continue
1.29
1.30 model_name, components = self._get_model_name_and_components(field)
1.31 @@ -96,7 +93,7 @@
1.32 # Traverse the components within the instance.
1.33
1.34 for component in components:
1.35 - t = component.split(self._pair_separator)
1.36 + t = component.split(Constants.pair_separator)
1.37 if len(t) == 1:
1.38 node.setAttributeNS(EMPTY_NAMESPACE, t[0], value)
1.39 break
1.40 @@ -123,7 +120,7 @@
1.41
1.42 # Process selectors only.
1.43
1.44 - selector_components = field.split(self._selector_indicator)
1.45 + selector_components = field.split(Constants.selector_indicator)
1.46 if len(selector_components) < 2:
1.47 continue
1.48
1.49 @@ -132,7 +129,7 @@
1.50 # but the separator really should not exist in the path.
1.51
1.52 selector_name = selector_components[0]
1.53 - path = self._selector_indicator.join(selector_components[1:])
1.54 + path = Constants.selector_indicator.join(selector_components[1:])
1.55
1.56 model_name, components = self._get_model_name_and_components(path)
1.57 if model_name is None:
1.58 @@ -149,7 +146,7 @@
1.59 # selected.
1.60
1.61 for component in components:
1.62 - t = component.split(self._pair_separator)
1.63 + t = component.split(Constants.pair_separator)
1.64 if len(t) == 1:
1.65
1.66 # Select attribute.
1.67 @@ -210,7 +207,7 @@
1.68 # Example: /name1#n1/name2#n2/name3
1.69 # Expected: ['', 'name1#n1', 'name2#n2', 'name3']
1.70
1.71 - components = field.split(self._path_separator)
1.72 + components = field.split(Constants.path_separator)
1.73 if len(components) < 2:
1.74 return None, None
1.75
1.76 @@ -218,7 +215,7 @@
1.77 # specification.
1.78 # Expected: ['name1', 'n1']
1.79
1.80 - model_name_and_index = components[1].split(self._pair_separator)
1.81 + model_name_and_index = components[1].split(Constants.pair_separator)
1.82 if len(model_name_and_index) != 2:
1.83 return None, None
1.84