def handle(self, *directories, **options): from django.db import transaction self.style = color_style() verbose = options.get('verbose') force = options.get('force') show_traceback = options.get('traceback', False) import_picture = options.get('import_picture') wait_until = None if options.get('wait_until'): wait_until = time.mktime( time.strptime(options.get('wait_until'), '%Y-%m-%d %H:%M:%S')) if verbose > 0: print "Will wait until %s; it's %f seconds from now" % ( time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime(wait_until)), wait_until - time.time()) index = None if options.get('search_index') and not settings.NO_SEARCH_INDEX: index = Index() try: index.index_tags() index.index.commit() except Exception, e: index.index.rollback() raise e
def setUp(self): WLTestCase.setUp(self) index = Index() index.index.delete_all() index.index.commit() with self.settings(NO_SEARCH_INDEX=False): self.do_doktora = Book.from_xml_file(get_fixture('do-doktora.xml')) self.do_anusie = Book.from_xml_file( get_fixture('fraszka-do-anusie.xml', catalogue))
def setUp(self): """ Setup index that will be subjected to the tests. """ self.index = Index(sample_stop_words())
}, { 'selector': '3', 'prompt': 'Exit', 'return': 'exit' }] selection = prompt.options("Browser or Terminal Engine", options) if selection == 'exit': print 'Bye' exit() global my_index, dirname dirname = path = prompt.query('Documents Path', default=os.getcwd(), validators=[validators.PathValidator()]) my_index = Index(dirname) if selection == 'web': app.run(debug=False) elif selection == 'cmd': while 1: options = [{ 'selector': '1', 'prompt': 'Query', 'return': 'cont' }, { 'selector': '2', 'prompt': 'Exit', 'return': 'exit' }]