Mercurial > kallithea
changeset 5124:e3aab61a9411
spelling: more consistent casing of 'API key'
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 13 May 2015 01:27:50 +0200 |
parents | 1f2269c26f93 |
children | 2aeaf6367929 |
files | kallithea/controllers/admin/my_account.py kallithea/controllers/admin/users.py kallithea/controllers/api/__init__.py kallithea/controllers/api/api.py kallithea/lib/auth.py kallithea/lib/dbmigrate/schema/db_2_2_0.py kallithea/lib/dbmigrate/schema/db_2_2_3.py kallithea/model/api_key.py kallithea/model/db.py kallithea/model/user.py kallithea/templates/admin/my_account/my_account_api_keys.html kallithea/templates/admin/users/user_edit_api_keys.html kallithea/tests/api/api_base.py kallithea/tests/functional/test_admin_users.py kallithea/tests/functional/test_login.py kallithea/tests/functional/test_my_account.py |
diffstat | 16 files changed, 37 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/my_account.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/controllers/admin/my_account.py Wed May 13 01:27:50 2015 +0200 @@ -251,7 +251,7 @@ description = request.POST.get('description') ApiKeyModel().create(self.authuser.user_id, description, lifetime) Session().commit() - h.flash(_("Api key successfully created"), category='success') + h.flash(_("API key successfully created"), category='success') return redirect(url('my_account_api_keys')) def my_account_api_keys_delete(self): @@ -263,10 +263,10 @@ user.api_key = generate_api_key(user.username) Session().add(user) Session().commit() - h.flash(_("Api key successfully reset"), category='success') + h.flash(_("API key successfully reset"), category='success') elif api_key: ApiKeyModel().delete(api_key, self.authuser.user_id) Session().commit() - h.flash(_("Api key successfully deleted"), category='success') + h.flash(_("API key successfully deleted"), category='success') return redirect(url('my_account_api_keys'))
--- a/kallithea/controllers/admin/users.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/controllers/admin/users.py Wed May 13 01:27:50 2015 +0200 @@ -311,7 +311,7 @@ description = request.POST.get('description') ApiKeyModel().create(c.user.user_id, description, lifetime) Session().commit() - h.flash(_("Api key successfully created"), category='success') + h.flash(_("API key successfully created"), category='success') return redirect(url('edit_user_api_keys', id=c.user.user_id)) def delete_api_key(self, id): @@ -327,11 +327,11 @@ user.api_key = generate_api_key(user.username) Session().add(user) Session().commit() - h.flash(_("Api key successfully reset"), category='success') + h.flash(_("API key successfully reset"), category='success') elif api_key: ApiKeyModel().delete(api_key, c.user.user_id) Session().commit() - h.flash(_("Api key successfully deleted"), category='success') + h.flash(_("API key successfully deleted"), category='success') return redirect(url('edit_user_api_keys', id=c.user.user_id))
--- a/kallithea/controllers/api/__init__.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/controllers/api/__init__.py Wed May 13 01:27:50 2015 +0200 @@ -134,7 +134,7 @@ message="JSON parse error ERR:%s RAW:%r" % (e, raw_body)) - # check AUTH based on API KEY + # check AUTH based on API key try: self._req_api_key = json_body['api_key'] self._req_id = json_body['id'] @@ -156,7 +156,7 @@ u = User.get_by_api_key(self._req_api_key) if u is None: return jsonrpc_error(retid=self._req_id, - message='Invalid API KEY') + message='Invalid API key') #check if we are allowed to use this IP auth_u = AuthUser(u.user_id, self._req_api_key, ip_addr=ip_addr) @@ -168,7 +168,7 @@ except Exception, e: return jsonrpc_error(retid=self._req_id, - message='Invalid API KEY') + message='Invalid API key') self._error = None try: @@ -208,7 +208,7 @@ # get our arglist and check if we provided them as args for arg, default in func_kwargs.iteritems(): if arg == USER_SESSION_ATTR: - # USER_SESSION_ATTR is something translated from api key and + # USER_SESSION_ATTR is something translated from API key and # this is checked before so we don't need validate it continue
--- a/kallithea/controllers/api/api.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/controllers/api/api.py Wed May 13 01:27:50 2015 +0200 @@ -553,7 +553,7 @@ { "user_id" : "<user_id>", "api_key" : "<api_key>", - "api_keys": "[<list of all api keys including additional ones>]" + "api_keys": "[<list of all API keys including additional ones>]" "username" : "<username>", "firstname": "<firstname>", "lastname" : "<lastname>",
--- a/kallithea/lib/auth.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/lib/auth.py Wed May 13 01:27:50 2015 +0200 @@ -146,7 +146,7 @@ def generate_api_key(str_, salt=None): """ - Generates API KEY from given string + Generates API key from given string :param str_: :param salt: @@ -519,9 +519,9 @@ log.debug('Auth User lookup by USER ID %s' % self.user_id) is_user_loaded = user_model.fill_data(self, user_id=self.user_id) - # try go get user by api key + # try go get user by API key elif self._api_key and self._api_key != self.anonymous_user.api_key: - log.debug('Auth User lookup by API KEY %s' % self._api_key) + log.debug('Auth User lookup by API key %s' % self._api_key) is_user_loaded = user_model.fill_data(self, api_key=self._api_key) # lookup by username
--- a/kallithea/lib/dbmigrate/schema/db_2_2_0.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_2_0.py Wed May 13 01:27:50 2015 +0200 @@ -437,7 +437,7 @@ user_comments = relationship('ChangesetComment', cascade='all') #extra emails for this user user_emails = relationship('UserEmailMap', cascade='all') - #extra api keys + #extra API keys user_api_keys = relationship('UserApiKeys', cascade='all')
--- a/kallithea/lib/dbmigrate/schema/db_2_2_3.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_2_3.py Wed May 13 01:27:50 2015 +0200 @@ -437,7 +437,7 @@ user_comments = relationship('ChangesetComment', cascade='all') #extra emails for this user user_emails = relationship('UserEmailMap', cascade='all') - #extra api keys + #extra API keys user_api_keys = relationship('UserApiKeys', cascade='all')
--- a/kallithea/model/api_key.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/model/api_key.py Wed May 13 01:27:50 2015 +0200 @@ -15,7 +15,7 @@ kallithea.model.api_key ~~~~~~~~~~~~~~~~~~~~~~~ -api key model for Kallithea +API key model for Kallithea This file was forked by the Kallithea project in July 2014. Original author and date, and relevant copyright and licensing information is below:
--- a/kallithea/model/db.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/model/db.py Wed May 13 01:27:50 2015 +0200 @@ -438,7 +438,7 @@ user_comments = relationship('ChangesetComment', cascade='all') #extra emails for this user user_emails = relationship('UserEmailMap', cascade='all') - #extra api keys + #extra API keys user_api_keys = relationship('UserApiKeys', cascade='all')
--- a/kallithea/model/user.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/model/user.py Wed May 13 01:27:50 2015 +0200 @@ -349,7 +349,7 @@ :param auth_user: instance of user to set attributes :param user_id: user id to fetch by - :param api_key: api key to fetch by + :param api_key: API key to fetch by :param username: username to fetch by """ if user_id is None and api_key is None and username is None:
--- a/kallithea/templates/admin/my_account/my_account_api_keys.html Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/templates/admin/my_account/my_account_api_keys.html Wed May 13 01:27:50 2015 +0200 @@ -11,7 +11,7 @@ ${h.hidden('del_api_key',c.user.api_key)} ${h.hidden('del_api_key_builtin',1)} <button class="btn btn-mini btn-danger" type="submit" - onclick="return confirm('${_('Confirm to reset this api key: %s') % c.user.api_key}');"> + onclick="return confirm('${_('Confirm to reset this API key: %s') % c.user.api_key}');"> ${_('reset')} </button> ${h.end_form()} @@ -37,7 +37,7 @@ ${h.form(url('my_account_api_keys'),method='delete')} ${h.hidden('del_api_key',api_key.api_key)} <button class="btn btn-mini btn-danger" type="submit" - onclick="return confirm('${_('Confirm to remove this api key: %s') % api_key.api_key}');"> + onclick="return confirm('${_('Confirm to remove this API key: %s') % api_key.api_key}');"> <i class="icon-minus-circled"></i> ${_('remove')} </button> @@ -46,7 +46,7 @@ </tr> %endfor %else: - <tr><td><div class="ip">${_('No additional api keys specified')}</div></td></tr> + <tr><td><div class="ip">${_('No additional API keys specified')}</div></td></tr> %endif </table> </div> @@ -58,7 +58,7 @@ <div class="fields"> <div class="field"> <div class="label"> - <label for="description">${_('New api key')}:</label> + <label for="description">${_('New API key')}:</label> </div> <div class="input"> ${h.text('description', class_='medium', placeholder=_('Description'))}
--- a/kallithea/templates/admin/users/user_edit_api_keys.html Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/templates/admin/users/user_edit_api_keys.html Wed May 13 01:27:50 2015 +0200 @@ -11,7 +11,7 @@ ${h.hidden('del_api_key',c.user.api_key)} ${h.hidden('del_api_key_builtin',1)} <button class="btn btn-mini btn-danger" type="submit" - onclick="return confirm('${_('Confirm to reset this api key: %s') % c.user.api_key}');"> + onclick="return confirm('${_('Confirm to reset this API key: %s') % c.user.api_key}');"> ${_('reset')} </button> ${h.end_form()} @@ -37,7 +37,7 @@ ${h.form(url('edit_user_api_keys', id=c.user.user_id),method='delete')} ${h.hidden('del_api_key',api_key.api_key)} <button class="btn btn-mini btn-danger" type="submit" - onclick="return confirm('${_('Confirm to remove this api key: %s') % api_key.api_key}');"> + onclick="return confirm('${_('Confirm to remove this API key: %s') % api_key.api_key}');"> <i class="icon-minus-circled"></i> ${_('remove')} </button> @@ -46,7 +46,7 @@ </tr> %endfor %else: - <tr><td><div class="ip">${_('No additional api keys specified')}</div></td></tr> + <tr><td><div class="ip">${_('No additional API keys specified')}</div></td></tr> %endif </table> </div> @@ -58,7 +58,7 @@ <div class="fields"> <div class="field"> <div class="label"> - <label for="description">${_('New api key')}:</label> + <label for="description">${_('New API key')}:</label> </div> <div class="input"> ${h.text('description', class_='medium', placeholder=_('Description'))}
--- a/kallithea/tests/api/api_base.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/tests/api/api_base.py Wed May 13 01:27:50 2015 +0200 @@ -166,7 +166,7 @@ id_, params = _build_data('trololo', 'get_user') response = api_call(self, params) - expected = 'Invalid API KEY' + expected = 'Invalid API key' self._compare_error(id_, expected, given=response.body) def test_api_missing_non_optional_param(self):
--- a/kallithea/tests/functional/test_admin_users.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/tests/functional/test_admin_users.py Wed May 13 01:27:50 2015 +0200 @@ -452,7 +452,7 @@ response = self.app.post(url('edit_user_api_keys', id=user_id), {'_method': 'put', 'description': desc, 'lifetime': lifetime, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully created') + self.checkSessionFlash(response, 'API key successfully created') try: response = response.follow() user = User.get(user_id) @@ -470,7 +470,7 @@ response = self.app.post(url('edit_user_api_keys', id=user_id), {'_method': 'put', 'description': 'desc', 'lifetime': -1, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully created') + self.checkSessionFlash(response, 'API key successfully created') response = response.follow() #now delete our key @@ -479,7 +479,7 @@ response = self.app.post(url('edit_user_api_keys', id=user_id), {'_method': 'delete', 'del_api_key': keys[0].api_key, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully deleted') + self.checkSessionFlash(response, 'API key successfully deleted') keys = UserApiKeys.query().filter(UserApiKeys.user_id == user_id).all() self.assertEqual(0, len(keys)) @@ -494,6 +494,6 @@ response = self.app.post(url('edit_user_api_keys', id=user_id), {'_method': 'delete', 'del_api_key_builtin': api_key, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully reset') + self.checkSessionFlash(response, 'API key successfully reset') response = response.follow() response.mustcontain(no=[api_key])
--- a/kallithea/tests/functional/test_login.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/tests/functional/test_login.py Wed May 13 01:27:50 2015 +0200 @@ -363,7 +363,7 @@ new_api_key = ApiKeyModel().create(TEST_USER_ADMIN_LOGIN, u'test') Session().commit() - #patch the api key and make it expired + #patch the API key and make it expired new_api_key.expires = 0 Session().add(new_api_key) Session().commit()
--- a/kallithea/tests/functional/test_my_account.py Wed May 13 01:27:50 2015 +0200 +++ b/kallithea/tests/functional/test_my_account.py Wed May 13 01:27:50 2015 +0200 @@ -201,7 +201,7 @@ user = User.get(usr['user_id']) response = self.app.post(url('my_account_api_keys'), {'description': desc, 'lifetime': lifetime, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully created') + self.checkSessionFlash(response, 'API key successfully created') try: response = response.follow() user = User.get(usr['user_id']) @@ -217,7 +217,7 @@ user = User.get(usr['user_id']) response = self.app.post(url('my_account_api_keys'), {'description': 'desc', 'lifetime': -1, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully created') + self.checkSessionFlash(response, 'API key successfully created') response = response.follow() #now delete our key @@ -226,7 +226,7 @@ response = self.app.post(url('my_account_api_keys'), {'_method': 'delete', 'del_api_key': keys[0].api_key, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully deleted') + self.checkSessionFlash(response, 'API key successfully deleted') keys = UserApiKeys.query().all() self.assertEqual(0, len(keys)) @@ -241,6 +241,6 @@ response = self.app.post(url('my_account_api_keys'), {'_method': 'delete', 'del_api_key_builtin': api_key, '_authentication_token': self.authentication_token()}) - self.checkSessionFlash(response, 'Api key successfully reset') + self.checkSessionFlash(response, 'API key successfully reset') response = response.follow() response.mustcontain(no=[api_key])