def update(self):
     logging.info("Checking sources for updates")
     for id, values in PageImporter.pages.iteritems():
         logging.info("Checking page: " + id + " (" + values['country'] + ")")
         page = Page(id, values['country'], values['url'])
         if page.import_tables() == 0:
             logging.info(id + " not modified")
         else:
             logging.info("Finished importing page: " + id + " (" + values['country'] + ")")
 def cl_import(self, cl_args):
     if('all' in cl_args):
         logging.info("START IMPORT")
         for id, values in PageImporter.pages.iteritems():
             logging.info("Importing page: " + id + " (" + values['country'] + ") " + str(datetime.now()))
             page = Page(id, values['country'], values['url'])
             page.import_tables(True)
             logging.info("Finished importing page: " + id + " (" + values['country'] + ")")
         logging.info("FINISHED IMPORT")
     else:
         logging.info("START IMPORT")
         for page_id in cl_args:
             if page_id not in PageImporter.pages:
                 if "-" in page_id:
                     for id, values in PageImporter.pages.iteritems():
                         if page_id in id:
                             logging.info("Importing page: " + id + " (" + values['country'] + " - " + values['url'] + ") " + str(datetime.now()))
                             page = Page(id, values['country'], values['url'])
                             page.import_tables(True)
                             logging.info("Finished importing page: " + id + " (" + values['country'] + ")")
                 else:
                     logging.warning("Page: " + page_id + " not in pages list")
                     continue
             else:
                 logging.info("Importing page: " + page_id + " (" + PageImporter.pages[page_id]['country'] + " - " + PageImporter.pages[page_id]['url'] + ")")
                 page = Page(page_id, PageImporter.pages[page_id]['country'], PageImporter.pages[page_id]['url'])
                 #print 'yes'
                 page.import_tables(True)
                 logging.info("Finished importing page: " + page_id + " (" + PageImporter.pages[page_id]['country'] + ")")
         logging.info("FINISHED IMPORT")