<s> from eulxml . xmlmap import ( <EOL> IntegerField , NodeField , NodeListField , <EOL> SimpleBooleanField , StringField , XmlObject , <EOL> load_xmlobject_from_string , <EOL> ) <EOL> from lxml import etree <EOL> from corehq . apps . app_manager . exceptions import UnknownInstanceError <EOL> class XPathField ( StringField ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class OrderedXmlObject ( XmlObject ) : <EOL> ORDER = ( ) <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> ordered_pairs = [ ] <EOL> for attr in self . ORDER : <EOL> value = kwargs . pop ( attr , None ) <EOL> if value : <EOL> ordered_pairs . append ( ( attr , value ) ) <EOL> super ( OrderedXmlObject , self ) . __init__ ( * args , ** kwargs ) <EOL> for attr , value in ordered_pairs : <EOL> setattr ( self , attr , value ) <EOL> class IdNode ( XmlObject ) : <EOL> id = StringField ( '<STR_LIT>' ) <EOL> class XpathVariable ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> name = StringField ( '<STR_LIT>' ) <EOL> locale_id = StringField ( '<STR_LIT>' ) <EOL> class Xpath ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> function = XPathField ( '<STR_LIT>' ) <EOL> variables = NodeListField ( '<STR_LIT>' , XpathVariable ) <EOL> class LocaleArgument ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> key = StringField ( '<STR_LIT>' ) <EOL> value = StringField ( '<STR_LIT:.>' ) <EOL> class Id ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT:id>' <EOL> xpath = NodeField ( '<STR_LIT>' , Xpath ) <EOL> class Locale ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> id = StringField ( '<STR_LIT>' ) <EOL> child_id = NodeField ( '<STR_LIT:id>' , Id ) <EOL> arguments = NodeListField ( '<STR_LIT>' , LocaleArgument ) <EOL> class Text ( XmlObject ) : <EOL> """<STR_LIT>""" <EOL> ROOT_NAME = '<STR_LIT:text>' <EOL> xpath = NodeField ( '<STR_LIT>' , Xpath ) <EOL> xpath_function = XPathField ( '<STR_LIT>' ) <EOL> locale = NodeField ( '<STR_LIT>' , Locale ) <EOL> locale_id = StringField ( '<STR_LIT>' ) <EOL> class ConfigurationItem ( Text ) : <EOL> ROOT_NAME = "<STR_LIT:text>" <EOL> id = StringField ( "<STR_LIT>" ) <EOL> class ConfigurationGroup ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> configs = NodeListField ( '<STR_LIT:text>' , ConfigurationItem ) <EOL> class Series ( OrderedXmlObject ) : <EOL> ORDER = ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ) <EOL> ROOT_NAME = '<STR_LIT>' <EOL> nodeset = StringField ( '<STR_LIT>' ) <EOL> configuration = NodeField ( '<STR_LIT>' , ConfigurationGroup ) <EOL> x_function = StringField ( '<STR_LIT>' ) <EOL> y_function = StringField ( '<STR_LIT>' ) <EOL> radius_function = StringField ( "<STR_LIT>" ) <EOL> class Annotation ( OrderedXmlObject ) : <EOL> ORDER = ( "<STR_LIT:x>" , "<STR_LIT:y>" , "<STR_LIT:text>" ) <EOL> ROOT_NAME = '<STR_LIT>' <EOL> x = NodeField ( '<STR_LIT>' , Text ) <EOL> y = NodeField ( '<STR_LIT>' , Text ) <EOL> text = NodeField ( '<STR_LIT:text>' , Text ) <EOL> class Graph ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> type = StringField ( "<STR_LIT>" , choices = [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> series = NodeListField ( '<STR_LIT>' , Series ) <EOL> configuration = NodeField ( '<STR_LIT>' , ConfigurationGroup ) <EOL> annotations = NodeListField ( '<STR_LIT>' , Annotation ) <EOL> class AbstractResource ( OrderedXmlObject ) : <EOL> ORDER = ( '<STR_LIT:id>' , '<STR_LIT:version>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> LOCATION_TEMPLATE = '<STR_LIT>' <EOL> local = StringField ( LOCATION_TEMPLATE % '<STR_LIT>' , required = True ) <EOL> remote = StringField ( LOCATION_TEMPLATE % '<STR_LIT>' , required = True ) <EOL> version = IntegerField ( '<STR_LIT>' ) <EOL> id = StringField ( '<STR_LIT>' ) <EOL> descriptor = StringField ( '<STR_LIT>' ) <EOL> class XFormResource ( AbstractResource ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> class LocaleResource ( AbstractResource ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> language = StringField ( '<STR_LIT>' ) <EOL> class MediaResource ( AbstractResource ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> path = StringField ( '<STR_LIT>' ) <EOL> class Display ( OrderedXmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT:text>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> text = NodeField ( '<STR_LIT:text>' , Text ) <EOL> media_image = StringField ( '<STR_LIT>' ) <EOL> media_audio = StringField ( '<STR_LIT>' ) <EOL> class DisplayNode ( XmlObject ) : <EOL> """<STR_LIT>""" <EOL> text = NodeField ( '<STR_LIT:text>' , Text ) <EOL> display = NodeField ( '<STR_LIT>' , Display ) <EOL> def __init__ ( self , node = None , context = None , <EOL> locale_id = None , media_image = None , media_audio = None , ** kwargs ) : <EOL> super ( DisplayNode , self ) . __init__ ( node , context , ** kwargs ) <EOL> self . set_display ( <EOL> locale_id = locale_id , <EOL> media_image = media_image , <EOL> media_audio = media_audio , <EOL> ) <EOL> def set_display ( self , locale_id = None , media_image = None , media_audio = None ) : <EOL> text = Text ( locale_id = locale_id ) if locale_id else None <EOL> if media_image or media_audio : <EOL> self . display = Display ( <EOL> text = text , <EOL> media_image = media_image , <EOL> media_audio = media_audio , <EOL> ) <EOL> elif text : <EOL> self . text = text <EOL> class LocaleId ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> locale_id = StringField ( '<STR_LIT>' ) <EOL> class MediaText ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT:text>' <EOL> form_name = StringField ( '<STR_LIT>' , choices = [ '<STR_LIT:image>' , '<STR_LIT>' ] ) <EOL> locale = NodeField ( '<STR_LIT>' , LocaleId ) <EOL> class LocalizedMediaDisplay ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> media_text = NodeListField ( '<STR_LIT:text>' , MediaText ) <EOL> class TextOrDisplay ( XmlObject ) : <EOL> text = NodeField ( '<STR_LIT:text>' , Text ) <EOL> display = NodeField ( '<STR_LIT>' , LocalizedMediaDisplay ) <EOL> def __init__ ( self , node = None , context = None , <EOL> menu_locale_id = None , image_locale_id = None , audio_locale_id = None , <EOL> media_image = None , media_audio = None , for_action_menu = False , ** kwargs ) : <EOL> super ( TextOrDisplay , self ) . __init__ ( node , context , ** kwargs ) <EOL> text = Text ( locale_id = menu_locale_id ) if menu_locale_id else None <EOL> media_text = [ ] <EOL> if media_image : <EOL> media_text . append ( MediaText ( <EOL> locale = LocaleId ( locale_id = image_locale_id ) , <EOL> form_name = '<STR_LIT:image>' , <EOL> ) ) <EOL> if media_audio : <EOL> media_text . append ( MediaText ( <EOL> locale = LocaleId ( locale_id = audio_locale_id ) , <EOL> form_name = '<STR_LIT>' <EOL> ) ) <EOL> if media_text : <EOL> self . display = LocalizedMediaDisplay ( <EOL> media_text = [ text ] + media_text if text else media_text <EOL> ) <EOL> elif for_action_menu and text : <EOL> self . display = LocalizedMediaDisplay ( <EOL> media_text = [ text ] <EOL> ) <EOL> elif text : <EOL> self . text = text <EOL> class CommandMixin ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> relevant = StringField ( '<STR_LIT>' ) <EOL> class LocalizedCommand ( CommandMixin , TextOrDisplay , IdNode ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Command ( CommandMixin , DisplayNode , IdNode ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Instance ( IdNode , OrderedXmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT:id>' , '<STR_LIT:src>' ) <EOL> src = StringField ( '<STR_LIT>' ) <EOL> class SessionDatum ( IdNode , OrderedXmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( <EOL> '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT:value>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> nodeset = XPathField ( '<STR_LIT>' ) <EOL> value = StringField ( '<STR_LIT>' ) <EOL> function = XPathField ( '<STR_LIT>' ) <EOL> detail_select = StringField ( '<STR_LIT>' ) <EOL> detail_confirm = StringField ( '<STR_LIT>' ) <EOL> detail_persistent = StringField ( '<STR_LIT>' ) <EOL> detail_inline = StringField ( '<STR_LIT>' ) <EOL> autoselect = SimpleBooleanField ( '<STR_LIT>' , true = "<STR_LIT:true>" , false = "<STR_LIT:false>" ) <EOL> class StackDatum ( IdNode ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> value = XPathField ( '<STR_LIT>' ) <EOL> class StackCommand ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> value = XPathField ( '<STR_LIT>' ) <EOL> command = StringField ( '<STR_LIT:.>' ) <EOL> class BaseFrame ( XmlObject ) : <EOL> if_clause = XPathField ( '<STR_LIT>' ) <EOL> class CreatePushBase ( IdNode , BaseFrame ) : <EOL> datums = NodeListField ( '<STR_LIT>' , StackDatum ) <EOL> commands = NodeListField ( '<STR_LIT>' , StackCommand ) <EOL> def add_command ( self , command ) : <EOL> node = etree . SubElement ( self . node , '<STR_LIT>' ) <EOL> node . attrib [ '<STR_LIT:value>' ] = command <EOL> def add_datum ( self , datum ) : <EOL> self . node . append ( datum . node ) <EOL> class CreateFrame ( CreatePushBase ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> class PushFrame ( CreatePushBase ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> class ClearFrame ( BaseFrame ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> frame = StringField ( '<STR_LIT>' ) <EOL> FRAME_CLASSES = ( CreateFrame , PushFrame , ClearFrame ) <EOL> FRAME_CLASSES_BY_ROOT = { frame_type . ROOT_NAME : frame_type <EOL> for frame_type in FRAME_CLASSES } <EOL> def _wrap_frame ( frame ) : <EOL> return FRAME_CLASSES_BY_ROOT [ frame . tag ] ( frame ) <EOL> class Stack ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> frames = NodeListField ( '<STR_LIT:*>' , _wrap_frame ) <EOL> def add_frame ( self , frame ) : <EOL> self . node . append ( frame . node ) <EOL> class Assertion ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> test = XPathField ( '<STR_LIT>' ) <EOL> text = NodeListField ( '<STR_LIT:text>' , Text ) <EOL> class Entry ( OrderedXmlObject , XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> form = StringField ( '<STR_LIT>' ) <EOL> command = NodeField ( '<STR_LIT>' , Command ) <EOL> instances = NodeListField ( '<STR_LIT>' , Instance ) <EOL> datums = NodeListField ( '<STR_LIT>' , SessionDatum ) <EOL> stack = NodeField ( '<STR_LIT>' , Stack ) <EOL> assertions = NodeListField ( '<STR_LIT>' , Assertion ) <EOL> def require_instances ( self , instances = ( ) , instance_ids = ( ) ) : <EOL> used = { ( instance . id , instance . src ) for instance in self . instances } <EOL> for instance in instances : <EOL> if ( instance . id , instance . src ) not in used : <EOL> self . instances . append ( <EOL> Instance ( id = instance . id , src = instance . src ) <EOL> ) <EOL> if len ( self . instances ) == <NUM_LIT:1> : <EOL> instance_node = self . node . find ( '<STR_LIT>' ) <EOL> command_node = self . node . find ( '<STR_LIT>' ) <EOL> self . node . remove ( instance_node ) <EOL> self . node . insert ( self . node . index ( command_node ) + <NUM_LIT:1> , <EOL> instance_node ) <EOL> covered_ids = { instance_id for instance_id , _ in used } <EOL> for instance_id in instance_ids : <EOL> if instance_id not in covered_ids : <EOL> raise UnknownInstanceError ( <EOL> "<STR_LIT>" <EOL> . format ( instance_id , getattr ( instance_id , '<STR_LIT>' , "<STR_LIT>" ) ) ) <EOL> sorted_instances = sorted ( self . instances , <EOL> key = lambda instance : instance . id ) <EOL> if sorted_instances != self . instances : <EOL> self . instances = sorted_instances <EOL> class QueryData ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT:data>' <EOL> key = StringField ( '<STR_LIT>' ) <EOL> ref = XPathField ( '<STR_LIT>' ) <EOL> class QueryPrompt ( DisplayNode ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> key = StringField ( '<STR_LIT>' ) <EOL> class SyncRequestPost ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> url = StringField ( '<STR_LIT>' ) <EOL> data = NodeListField ( '<STR_LIT:data>' , QueryData ) <EOL> class SyncRequestQuery ( OrderedXmlObject , XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT:data>' , '<STR_LIT>' ) <EOL> url = StringField ( '<STR_LIT>' ) <EOL> storage_instance = StringField ( '<STR_LIT>' ) <EOL> data = NodeListField ( '<STR_LIT:data>' , QueryData ) <EOL> prompts = NodeListField ( '<STR_LIT>' , QueryPrompt ) <EOL> class SyncRequestSession ( OrderedXmlObject , XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> queries = NodeListField ( '<STR_LIT>' , SyncRequestQuery ) <EOL> data = NodeListField ( '<STR_LIT>' , SessionDatum ) <EOL> class SyncRequest ( OrderedXmlObject , XmlObject ) : <EOL> """<STR_LIT>""" <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> post = NodeField ( '<STR_LIT>' , SyncRequestPost ) <EOL> instances = NodeListField ( '<STR_LIT>' , Instance ) <EOL> command = NodeField ( '<STR_LIT>' , Command ) <EOL> session = NodeField ( '<STR_LIT>' , SyncRequestSession ) <EOL> stack = NodeField ( '<STR_LIT>' , Stack ) <EOL> class MenuMixin ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> root = StringField ( '<STR_LIT>' ) <EOL> relevant = XPathField ( '<STR_LIT>' ) <EOL> style = StringField ( '<STR_LIT>' ) <EOL> commands = NodeListField ( '<STR_LIT>' , Command ) <EOL> class Menu ( MenuMixin , DisplayNode , IdNode ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class LocalizedMenu ( MenuMixin , TextOrDisplay , IdNode ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class AbstractTemplate ( XmlObject ) : <EOL> form = StringField ( '<STR_LIT>' , choices = [ '<STR_LIT:image>' , '<STR_LIT>' , '<STR_LIT:address>' ] ) <EOL> width = IntegerField ( '<STR_LIT>' ) <EOL> text = NodeField ( '<STR_LIT:text>' , Text ) <EOL> class Template ( AbstractTemplate ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> class GraphTemplate ( Template ) : <EOL> form = StringField ( '<STR_LIT>' , choices = [ '<STR_LIT>' ] ) <EOL> graph = NodeField ( '<STR_LIT>' , Graph ) <EOL> class Header ( AbstractTemplate ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> class Sort ( AbstractTemplate ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> type = StringField ( '<STR_LIT>' ) <EOL> order = StringField ( '<STR_LIT>' ) <EOL> direction = StringField ( '<STR_LIT>' ) <EOL> class Style ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> horz_align = StringField ( "<STR_LIT>" ) <EOL> vert_align = StringField ( "<STR_LIT>" ) <EOL> font_size = StringField ( "<STR_LIT>" ) <EOL> css_id = StringField ( "<STR_LIT>" ) <EOL> grid_height = StringField ( "<STR_LIT>" ) <EOL> grid_width = StringField ( "<STR_LIT>" ) <EOL> grid_x = StringField ( "<STR_LIT>" ) <EOL> grid_y = StringField ( "<STR_LIT>" ) <EOL> class Extra ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> key = StringField ( "<STR_LIT>" ) <EOL> value = StringField ( "<STR_LIT>" ) <EOL> class Response ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> key = StringField ( "<STR_LIT>" ) <EOL> class Lookup ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> name = StringField ( "<STR_LIT>" ) <EOL> action = StringField ( "<STR_LIT>" , required = True ) <EOL> image = StringField ( "<STR_LIT>" ) <EOL> extras = NodeListField ( '<STR_LIT>' , Extra ) <EOL> responses = NodeListField ( '<STR_LIT>' , Response ) <EOL> class Field ( OrderedXmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> sort = StringField ( '<STR_LIT>' ) <EOL> style = NodeField ( '<STR_LIT>' , Style ) <EOL> header = NodeField ( '<STR_LIT>' , Header ) <EOL> template = NodeField ( '<STR_LIT>' , Template ) <EOL> sort_node = NodeField ( '<STR_LIT>' , Sort ) <EOL> background = NodeField ( '<STR_LIT>' , Text ) <EOL> class ActionMixin ( OrderedXmlObject ) : <EOL> ROOT_NAME = '<STR_LIT:action>' <EOL> ORDER = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> stack = NodeField ( '<STR_LIT>' , Stack ) <EOL> class Action ( ActionMixin ) : <EOL> """<STR_LIT>""" <EOL> display = NodeField ( '<STR_LIT>' , Display ) <EOL> class LocalizedAction ( ActionMixin , TextOrDisplay ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class DetailVariable ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT:_>' <EOL> function = XPathField ( '<STR_LIT>' ) <EOL> def get_name ( self ) : <EOL> return self . node . tag <EOL> def set_name ( self , value ) : <EOL> self . node . tag = value <EOL> name = property ( get_name , set_name ) <EOL> class DetailVariableList ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> variables = NodeListField ( '<STR_LIT:_>' , DetailVariable ) <EOL> class Detail ( OrderedXmlObject , IdNode ) : <EOL> """<STR_LIT>""" <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT:title>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> nodeset = StringField ( '<STR_LIT>' ) <EOL> title = NodeField ( '<STR_LIT>' , Text ) <EOL> lookup = NodeField ( '<STR_LIT>' , Lookup ) <EOL> fields = NodeListField ( '<STR_LIT>' , Field ) <EOL> action = NodeField ( '<STR_LIT:action>' , Action ) <EOL> details = NodeListField ( '<STR_LIT>' , "<STR_LIT>" ) <EOL> _variables = NodeField ( '<STR_LIT>' , DetailVariableList ) <EOL> def _init_variables ( self ) : <EOL> if self . _variables is None : <EOL> self . _variables = DetailVariableList ( ) <EOL> def get_variables ( self ) : <EOL> self . _init_variables ( ) <EOL> return self . _variables . variables <EOL> def set_variables ( self , value ) : <EOL> self . _init_variables ( ) <EOL> self . _variables . variables = value <EOL> variables = property ( get_variables , set_variables ) <EOL> def get_all_xpaths ( self ) : <EOL> result = set ( ) <EOL> if self . nodeset : <EOL> result . add ( self . nodeset ) <EOL> if self . _variables : <EOL> for variable in self . variables : <EOL> result . add ( variable . function ) <EOL> if self . action : <EOL> for frame in self . action . stack . frames : <EOL> result . add ( frame . if_clause ) <EOL> for datum in getattr ( frame , '<STR_LIT>' , [ ] ) : <EOL> result . add ( datum . value ) <EOL> def _get_graph_config_xpaths ( configuration ) : <EOL> result = set ( ) <EOL> for config in configuration . configs : <EOL> result . add ( config . xpath_function ) <EOL> return result <EOL> for field in self . fields : <EOL> if field . template . form == '<STR_LIT>' : <EOL> s = etree . tostring ( field . template . node ) <EOL> template = load_xmlobject_from_string ( s , xmlclass = GraphTemplate ) <EOL> result . update ( _get_graph_config_xpaths ( template . graph . configuration ) ) <EOL> for series in template . graph . series : <EOL> result . add ( series . nodeset ) <EOL> result . update ( _get_graph_config_xpaths ( series . configuration ) ) <EOL> else : <EOL> result . add ( field . header . text . xpath_function ) <EOL> result . add ( field . template . text . xpath_function ) <EOL> for detail in self . details : <EOL> result . update ( detail . get_all_xpaths ( ) ) <EOL> result . discard ( None ) <EOL> return result <EOL> class Fixture ( IdNode ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> user_id = StringField ( '<STR_LIT>' ) <EOL> def set_content ( self , xml ) : <EOL> for child in self . node : <EOL> self . node . remove ( child ) <EOL> self . node . append ( xml ) <EOL> class ScheduleFixtureVisit ( IdNode ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> due = IntegerField ( '<STR_LIT>' ) <EOL> starts = IntegerField ( '<STR_LIT>' ) <EOL> expires = IntegerField ( '<STR_LIT>' ) <EOL> repeats = StringField ( '<STR_LIT>' ) <EOL> increment = IntegerField ( '<STR_LIT>' ) <EOL> class Schedule ( XmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> starts = IntegerField ( '<STR_LIT>' ) <EOL> expires = IntegerField ( '<STR_LIT>' ) <EOL> allow_unscheduled = StringField ( '<STR_LIT>' ) <EOL> visits = NodeListField ( '<STR_LIT>' , ScheduleFixtureVisit ) <EOL> class ScheduleFixture ( Fixture ) : <EOL> schedule = NodeField ( '<STR_LIT>' , Schedule ) <EOL> class Suite ( OrderedXmlObject ) : <EOL> ROOT_NAME = '<STR_LIT>' <EOL> ORDER = ( '<STR_LIT:version>' , '<STR_LIT>' ) <EOL> version = IntegerField ( '<STR_LIT>' ) <EOL> descriptor = StringField ( '<STR_LIT>' ) <EOL> xform_resources = NodeListField ( '<STR_LIT>' , XFormResource ) <EOL> locale_resources = NodeListField ( '<STR_LIT>' , LocaleResource ) <EOL> media_resources = NodeListField ( '<STR_LIT>' , MediaResource ) <EOL> details = NodeListField ( '<STR_LIT>' , Detail ) <EOL> entries = NodeListField ( '<STR_LIT>' , Entry ) <EOL> menus = NodeListField ( '<STR_LIT>' , Menu ) <EOL> sync_requests = NodeListField ( '<STR_LIT>' , SyncRequest ) <EOL> fixtures = NodeListField ( '<STR_LIT>' , Fixture ) </s>
