aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/requests/issues/labels.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygithub3/requests/issues/labels.py')
-rw-r--r--pygithub3/requests/issues/labels.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/pygithub3/requests/issues/labels.py b/pygithub3/requests/issues/labels.py
index 47337f9..75e11e4 100644
--- a/pygithub3/requests/issues/labels.py
+++ b/pygithub3/requests/issues/labels.py
@@ -18,11 +18,13 @@ class Create(Request):
'required': ('name', 'color' )
}
- def validate_color(color):
- color = color.get('color', '')
+ def clean_body(self):
+ color = self.body.get('color', '')
if not Label.is_valid_color(color):
raise ValidationError('colors must have 6 hexadecimal characters, '
'without # in the beggining')
+ else:
+ return self.body
class Update(Request):
@@ -33,12 +35,13 @@ class Update(Request):
'schema': ('name', 'color'),
'required': ('name', 'color' )
}
-
- def validate_color(color):
- color = color.get('color', '')
+ def clean_body(self):
+ color = self.body.get('color', '')
if not Label.is_valid_color(color):
raise ValidationError('colors must have 6 hexadecimal characters, '
'without # in the beggining')
+ else:
+ return self.body
class Delete(Request):
@@ -61,6 +64,7 @@ class Add_to_issue(Request):
uri = 'repos/{user}/{repo}/issues/{number}/labels'
resource = Label
+
class Remove_from_issue(Request):
uri = 'repos/{user}/{repo}/issues/{number}/labels/{name}'
resource = Label