def OnImportWretch(self, e): dialog = wx.FileDialog(self) result = dialog.ShowModal() dialog.Destroy() if result != wx.ID_OK: return file = dialog.GetFilename() dir = dialog.GetDirectory() filename = os.path.join(dir, file) wi = WretchImporter(filename) blogdata = wi.parse() self.setBlogData(blogdata)
def OnImportWretch(self, e) : dialog = wx.FileDialog(self) result = dialog.ShowModal() dialog.Destroy() if result != wx.ID_OK : return file = dialog.GetFilename() dir = dialog.GetDirectory() filename = os.path.join(dir, file) wi = WretchImporter(filename) blogdata = wi.parse() self.setBlogData(blogdata)
def main(): long_opts = ["import-wretch=", "import-blogger="] opts, args = getopt.getopt(sys.argv[1:], "n", long_opts) no_window = False for o, a in opts: if o == "-n": no_window = True if o == "--import-wretch": blogdata = WretchImporter(a).parse() print "%d articles, %d comments" % (blogdata.article_count(), blogdata.comment_count()) if o == "--import-blogger": blogdata = BloggerImporter(a).parse() print "%d articles, %d comments" % (blogdata.article_count(), blogdata.comment_count()) if not no_window: app = wx.PySimpleApp() frame = MainWindow() app.MainLoop()
def main() : long_opts = [ "import-wretch=", "import-blogger=" ] opts, args = getopt.getopt(sys.argv[1:], "n", long_opts) blogdata = None no_window = False for o, a in opts : if o=="-n" : no_window = True if o=="--import-wretch" : blogdata = WretchImporter(a).parse() print "%d articles, %d comments" % ( blogdata.article_count(), blogdata.comment_count() ) if o=="--import-blogger" : blogdata = BloggerImporter(a).parse() print "%d articles, %d comments" % ( blogdata.article_count(), blogdata.comment_count() ) if not no_window : app = wx.PySimpleApp() frame = MainWindow() if blogdata!=None: frame.setBlogData(blogdata) app.MainLoop()
def test_parse_date(self): assert datetime(2007, 9, 15, 13, 7) == WretchImporter.parse_date("2007-09-15 13:07:00")
def test_parse_incorrect_datedate(self) : assert datetime(2007,2,28,13,7)==WretchImporter.parse_date("2007-02-31 13:07:00")
def test_parse_date(self) : assert datetime(2007,9,15,13,7)==WretchImporter.parse_date("2007-09-15 13:07:00")