Ignore:
Timestamp:
Apr 21, 2010 5:31:03 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
f7a54c6
Parents:
f54e8e4
Message:

Get topology information into the info operation, as annotations of a topology description. This required adding such information to the start segment replies as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_client.py

    rf54e8e4 rb4b19c7  
    134134        self.add_option("--data", dest="data", default=[],
    135135                action="append", type="choice",
    136                 choices=("id", "federant", "vtopo", "vis", "log", "status"),
     136                choices=("id", "experimentdescription", "federant", "vtopo",
     137                    "vis", "log", "status"),
    137138                help="data to extract")
    138139
     
    360361        # called.
    361362        self.params = {
    362                 'vis': ('vis', self.print_xml('vis')),
    363                 'vtopo': ('vtopo', self.print_xml('vtopo')),
     363                'vis': ('vis', self.print_vis_or_vtopo('vis')),
     364                'vtopo': ('vtopo', self.print_vis_or_vtopo('vtopo')),
    364365                'federant': ('federant', self.print_xml),
     366                'experimentdescription': \
     367                        ('experimentdescription', self.print_xml),
    365368                'id': ('experimentID', self.print_id),
    366369                'status': ('experimentStatus', self.print_string),
     
    379382                    print >>out, "%s: %s" % (k, id[k])
    380383
    381     class print_xml:
     384    def print_xml(self, d, out=sys.stdout):
     385        """
     386        Very simple ugly xml formatter of the kinds of dicts that come back
     387        from services.
     388        """
     389        if isinstance(d, dict):
     390            for k, v in d.items():
     391                print >>out, "<%s>" % k
     392                self.print_xml(v, out)
     393                print >>out, "</%s>" % k
     394        elif isinstance(d, list):
     395            for x in d:
     396                self.print_xml(x, out)
     397        else:
     398            print >>out, d
     399
     400
     401    class print_vis_or_vtopo:
    382402        """
    383403        Print the retrieved data is a simple xml representation of the dict.
Note: See TracChangeset for help on using the changeset viewer.