Exemple #1
0
 def test_import_xml(self):
     filename = os.path.join(settings.root, "tests", "authorts.xml")
     urls = (
         ("http://samlib.ru/k/kontorowich_a_s/", "Конторович Александр Сергеевич"),
         ("http://samlib.ru/k/kotow_w_n/", "Конюшевский  Владислав Николаевич"),
     )
     core.import_from_xml(filename=filename)
     for url, name in urls:
         author = models.Author.get_by_url(url=url)
         self.assertEqual(author.name, name)
Exemple #2
0
 def test_import_xml(self):
     filename = os.path.join(settings.root, 'tests', 'authorts.xml')
     urls = (
         ("http://samlib.ru/k/kontorowich_a_s/",
          "Конторович Александр Сергеевич"),
         ("http://samlib.ru/k/kotow_w_n/",
          "Конюшевский  Владислав Николаевич"),
     )
     core.import_from_xml(filename=filename)
     for url, name in urls:
         author = models.Author.get_by_url(url=url)
         self.assertEqual(author.name, name)
Exemple #3
0
        exit()

    settings.DB = args.db
    settings.USE_PROXY = args.use_proxy or args.proxy is not None
    if settings.USE_PROXY and args.proxy:
        settings.PROXY = args.proxy

    is_console = False
    try:
        init = not os.path.exists(settings.DB)
        models.init_connection(init=init)
        if init:
            core.create_author("http://samlib.ru/p/pupkin_wasja_ibragimowich/"
                               "indexdate.shtml")
        if args.import_xml:
            core.import_from_xml(args.import_xml)

        if args.url_fix:
            #core.authors_urls_to_samlib()
            core.authors_urls_to_zhurnal_lib()
        if args.check:
            is_console = True
            for author in core.check_all_authors():
                pass

        for url in args.remove_authors:
            is_console = True
            core.delete_author(url)

        for url in args.add_authors:
            is_console = True
Exemple #4
0
        exit()

    settings.DB = args.db
    settings.USE_PROXY = args.use_proxy or args.proxy is not None
    if settings.USE_PROXY and args.proxy:
        settings.PROXY = args.proxy

    is_console = False
    try:
        init = not os.path.exists(settings.DB)
        models.init_connection(init=init)
        if init:
            core.create_author("http://samlib.ru/p/pupkin_wasja_ibragimowich/"
                               "indexdate.shtml")
        if args.import_xml:
            core.import_from_xml(args.import_xml)

        if args.url_fix:
            core.authors_urls_to_samlib()
        if args.check:
            is_console = True
            for author in core.check_all_authors():
                pass

        for url in args.remove_authors:
            is_console = True
            core.delete_author(url)

        for url in args.add_authors:
            is_console = True
            core.create_author(url)