def __init__(self, name): WebApp.__init__(self, "JournalsApp") self.route('/', method='GET', callback=self.journal_list) self.route('/detail/:uuid', method='GET', callback=self.journal_detail) self.route('/health/:uuid', method='GET', callback=self.journal_health) self.route( '/health/:uuid', method='POST', callback=self.journal_health_update) self.route( '/deposits/:uuid', method='GET', callback=self.journal_deposits)
def test_get_request_lang(self): application = WebApp('testapp') lang = application.get_request_lang('da, en-gb;q=0.8, en;q=0.7') self.assertEquals('en-US', lang) lang = application.get_request_lang('en, en-gb;q=0.8, en-CA;q=0.7') self.assertEquals('en-CA', lang) lang = application.get_request_lang('en, en-CA;q=0.8, en-US;q=0.7') self.assertEquals('en-CA', lang) lang = application.get_request_lang(None) self.assertEquals('en-US', lang)
def __init__(self, name): WebApp.__init__(self, "SwordApp") self.route('/sd-iri', method='GET', callback=self.service_document) self.route('/col-iri/<journal_uuid>', method='POST', callback=self.create_deposit) self.route('/cont-iri/<journal_uuid>/<deposit_uuid>/state', method='GET', callback=self.sword_statement) self.route('/cont-iri/<journal_uuid>/<deposit_uuid_param>/edit', method='PUT', callback=self.edit_deposit)
def __init__(self, name): WebApp.__init__(self, "TermsApp") self.route('/', method='GET', callback=self.terms_list) self.route('/list', method='GET', callback=self.terms_list) self.route('/list_terms', method='GET', callback=self.terms_list) self.route('/detail/:key_code', method='GET', callback=self.term_detail) self.route('/sort', method='GET', callback=self.terms_sort) self.route('/sort', method='POST', callback=self.terms_sort_save) self.route('/translate', method='GET', callback=self.terms_translate) self.route('/translate', method='POST', callback=self.terms_translate_save) self.route('/add_term', method='GET', callback=self.add_term) self.route('/edit_term/:key_code', method='GET', callback=self.edit_term) self.route('/edit_term/:key_code/:lang_code', method='GET', callback=self.edit_term) self.route('/save', method='POST', callback=self.save_term)
def __init__(self, *args): QListView.__init__(self, *args) self.setModel( AppListModel( [WebApp.get_local_apps_dir(), utils.libFile('.')], self)) self.setIconSize(QtCore.QSize(kIconSize, kIconSize)) self.downloadErrShown = False # To be set through functions self.win = None
def createApp(self): """Create a new application from a URL.""" dialog = QtGui.QDialog() from ui_newapp import Ui_NewApp dialog.ui = Ui_NewApp() dialog.ui.setupUi(dialog) while True: if not dialog.exec_(): # Cancelled. return try: WebApp.createWebApp( str(dialog.ui.editAppName.text()), str(dialog.ui.editURL.text())) break except ValueError as e: QtGui.QMessageBox.warning(self, _("Error"), _("Error %s") % e.message) except urllib2.URLError as e: QtGui.QMessageBox.warning(self, _("Error"), _("Network Error %s") % e.message) self.ui.listAppStock.model().loadData()