def register(): form = NameForm() note = 'Register now!' if form.validate_on_submit(): if add(form.name.data, form.passwd.data): return redirect(url_for('index')) else: note = 'Register error!' return render_template('register.html', note=note, form=form)
def add_stats(client_data, stats): stats[u'ip'] = client_data['ip'].decode("utf-8") engine = create_engine('sqlite:///client_statistics.db', echo=True) Session = sessionmaker(bind=engine) session = Session() machine_stat = models.add(stats) print stats print machine_stat.ip session.add(machine_stat) session.commit()
def download(request): global process global ad if(process == None): return HttpResponseRedirect('/') link = request.GET.get('link') if link != '1': down_link = add(link) else: link = ad.get_updates() down_link = add_link_list(link) if(down_link != None): process.download_link(down_link) else: return HttpResponse('redown') return HttpResponse(down_link)
).order_by("time_added").extra(where=["id is not null"] ).distinct().reverse()), list(models_tests.doc.objects.exclude(pk__in=range(600) ).order_by("time_added").extra(where=["id is not null"] ).distinct().reverse()), ) if __name__ == "__main__" : from django.conf import settings settings.SEARCH_STORAGE_PATH = settings.SEARCH_STORAGE_PATH + "_test" settings.SEARCH_STORAGE_TYPE = "ram" import core, pylucene import models as models_tests models_tests.add() models_tests.cleanup_docs(models_tests.doc_without_index) models_tests.insert_docs(5, model=models_tests.doc_without_index) unittest.main(testRunner=models_tests.SearcherTestRunner(verbosity=2)) """ Description ----------- ChangeLog ---------
self.assertEqual( set([i.pk for i in o]), set([i.pk for i in o_n]), ) if __name__ == "__main__": from django.conf import settings settings.SEARCH_STORAGE_PATH = settings.SEARCH_STORAGE_PATH + "_test" settings.DEBUG = False import core, pylucene import models as models_tests models_tests.add() models_tests.cleanup_docs(models_tests.doc_without_index) models_tests.insert_docs(5, model=models_tests.doc_without_index) unittest.main(testRunner=models_tests.SearcherTestRunner(verbosity=2)) """ Description ----------- ChangeLog --------- Usage
def post(self): form = MeetmeForm() if form.validate_on_submit(): with session_scope(): meetme_dao.add(form) return redirect(url_for('meetme.Meetme:index'))