예제 #1
0
 def test_convertStyle(self):
     appl = service.Application("lala")
     for instyle in "source pickle".split():
         for outstyle in "source pickle".split():
             sob.IPersistable(appl).setStyle(instyle)
             sob.IPersistable(appl).save(filename="converttest")
             app.convertStyle("converttest", instyle, None, "converttest.out", outstyle, 0)
             appl2 = service.loadApplication("converttest.out", outstyle)
             self.assertEqual(service.IService(appl2).name, "lala")
예제 #2
0
 def test_convertStyle(self):
     appl = service.Application("lala")
     for instyle in 'source pickle'.split():
         for outstyle in 'source pickle'.split():
             sob.IPersistable(appl).setStyle(instyle)
             sob.IPersistable(appl).save(filename="converttest")
             app.convertStyle("converttest", instyle, None,
                              "converttest.out", outstyle, 0)
             appl2 = service.loadApplication("converttest.out", outstyle)
             self.assertEqual(service.IService(appl2).name, "lala")
예제 #3
0
 def test_convertStyle(self):
     appl = service.Application("lala")
     for instyle in "xml source pickle".split():
         if instyle == "xml" and not gotMicrodom:
             continue
         for outstyle in "xml source pickle".split():
             if outstyle == "xml" and not gotMicrodom:
                 continue
             sob.IPersistable(appl).setStyle(instyle)
             sob.IPersistable(appl).save(filename="converttest")
             app.convertStyle("converttest", instyle, None, "converttest.out", outstyle, 0)
             appl2 = service.loadApplication("converttest.out", outstyle)
             self.assertEqual(service.IService(appl2).name, "lala")
예제 #4
0
 def test_convertStyle(self):
     appl = service.Application("lala")
     for instyle in 'xml source pickle'.split():
         if instyle == 'xml' and not gotMicrodom:
             continue
         for outstyle in 'xml source pickle'.split():
             if outstyle == 'xml' and not gotMicrodom:
                 continue
             sob.IPersistable(appl).setStyle(instyle)
             sob.IPersistable(appl).save(filename="converttest")
             app.convertStyle("converttest", instyle, None,
                              "converttest.out", outstyle, 0)
             appl2 = service.loadApplication("converttest.out", outstyle)
             self.assertEqual(service.IService(appl2).name, "lala")
예제 #5
0
    compData = usage.Completions(
        optActions={"typein": usage.CompleteList(["guess", "python", "pickle",
                                                  "xml", "source"]),
                    "typeout": usage.CompleteList(["pickle", "xml", "source"]),
                    "in": usage.CompleteFiles(descr="tap file to read from"),
                    "out": usage.CompleteFiles(descr="tap file to write to"),
                    }
        )

    def postOptions(self):
        if self['in'] is None:
            raise usage.UsageError("%s\nYou must specify the input filename."
                                   % self)
        if self["typein"] == "guess":
            try:
                self["typein"] = sob.guessType(self["in"])
            except KeyError:
                raise usage.UsageError("Could not guess type for '%s'" %
                                       self["typein"])

def run():
    options = ConvertOptions()
    try:
        options.parseOptions(sys.argv[1:])
    except usage.UsageError, e:
        print e
    else:
        app.convertStyle(options["in"], options["typein"],
                     options.opts['decrypt'] or getpass.getpass('Passphrase: '),
                     options["out"], options['typeout'], options["encrypt"])