def createFeedback(): updateFeedbackForm = CreateFeedback(request.form) if request.method == 'POST' and updateFeedbackForm.validate(): feedbackDict = {} db = shelve.open('feedback.db', 'c') try: feedbackDict = db['Feedback'] except: print('Error in retrieving feedback from Feedback.db.') feedback = Feedback.Feedback(updateFeedbackForm.name.data, updateFeedbackForm.number.data, updateFeedbackForm.feedbackZ.data) feedbackDict[feedback.get_feedbackID()] = feedback db['Feedback'] = feedbackDict db.close() return redirect(url_for('home')) return render_template('contactUs.html', form=updateFeedbackForm, status='admin')
# -*- coding: utf-8 -*- """ Created on Mon May 26 23:42:03 2014 @author: Vespa """ import os from Feedback import * fb = Feedback() Desktop_Path = '%s/Desktop/'%(os.path.expanduser('~')) list_dirs = os.listdir(Desktop_Path) for line in list_dirs: filepath = os.path.join(Desktop_Path,line) if not os.path.isdir(filepath): if line.endswith('xml'): xmlid = line.split('.')[0] fb.add_item(xmlid+'.xml',subtitle='转化'+xmlid+'.xml',arg=xmlid) print fb
def test_execute(self, mocked_params): fb = Feedback() fb.execute(input_message="fake message", params=mocked_params) assert not fb._params