diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2013-12-26 13:21:12 +0100 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2013-12-26 13:21:39 +0100 |
commit | 1969abb3bbb61c4cbb8499496be9f48bd74cf558 (patch) | |
tree | 9cce34ff1c23a8ae9618af4af6f9151fcd488405 | |
parent | e31bb9ea26a5ab3299464f37e0931bfee8b7cb62 (diff) | |
download | gitlab-1969abb3bbb61c4cbb8499496be9f48bd74cf558.tar.gz |
add a Key() method for User objects
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | gitlab.py | 21 |
3 files changed, 18 insertions, 8 deletions
@@ -9,3 +9,4 @@ Contributors Daniel Kimsey <dekimsey@ufl.edu> Erik Weatherwax <erik.weatherwax@xls.xerox.com> Andrew Austin <aaustin@terremark.com> +Koen Smets <koen.smets@gmail.com> @@ -1,3 +1,7 @@ +Version 0.5 + + * Add SSH key for user + Version 0.4 * Fix strings encoding (Closes #6) @@ -541,14 +541,6 @@ class GitlabObject(object): return json.dumps(self.__dict__, cls=jsonEncoder) -class User(GitlabObject): - _url = '/users' - shortPrintAttr = 'username' - requiredCreateAttrs = ['email', 'password', 'username', 'name'] - optionalCreateAttrs = ['skype', 'linkedin', 'twitter', 'projects_limit', - 'extern_uid', 'provider', 'bio'] - - class UserKey(GitlabObject): _url = '/users/%(user_id)s/keys' canGet = False @@ -558,6 +550,19 @@ class UserKey(GitlabObject): requiredCreateAttrs = ['user_id', 'title', 'key'] +class User(GitlabObject): + _url = '/users' + shortPrintAttr = 'username' + requiredCreateAttrs = ['email', 'password', 'username', 'name'] + optionalCreateAttrs = ['skype', 'linkedin', 'twitter', 'projects_limit', + 'extern_uid', 'provider', 'bio'] + + def Key(self, id=None, **kwargs): + return self._getListOrObject(UserKey, id, + user_id=self.id, + **kwargs) + + class CurrentUserKey(GitlabObject): _url = '/user/keys' canUpdate = False |