@@ -670,35 +670,55 @@ def download(self, id_num):
670
670
@requires_auth
671
671
def edit (self ,
672
672
name ,
673
- description = '' ,
674
- homepage = '' ,
675
- private = False ,
676
- has_issues = True ,
677
- has_wiki = True ,
678
- has_downloads = True ,
679
- default_branch = '' ):
673
+ description = None ,
674
+ homepage = None ,
675
+ private = None ,
676
+ has_issues = None ,
677
+ has_wiki = None ,
678
+ has_downloads = None ,
679
+ default_branch = None ):
680
680
"""Edit this repository.
681
681
682
682
:param str name: (required), name of the repository
683
- :param str description: (optional)
684
- :param str homepage: (optional)
685
- :param bool private: (optional), If ``True``, create a
686
- private repository. API default: ``False``
687
- :param bool has_issues: (optional), If ``True``, enable
688
- issues for this repository. API default: ``True``
689
- :param bool has_wiki: (optional), If ``True``, enable the
690
- wiki for this repository. API default: ``True``
691
- :param bool has_downloads: (optional), If ``True``, enable
692
- downloads for this repository. API default: ``True``
693
- :param str default_branch: (optional), Update the default branch for
694
- this repository
683
+ :param str description: (optional), If not ``None``, change the
684
+ description for this repository. API default: ``None`` - leave
685
+ value unchanged.
686
+ :param str homepage: (optional), If not ``None``, change the homepage
687
+ for this repository. API default: ``None`` - leave value unchanged.
688
+ :param bool private: (optional), If ``True``, make the repository
689
+ private. If ``False``, make the repository public. API default:
690
+ ``None`` - leave value unchanged.
691
+ :param bool has_issues: (optional), If ``True``, enable issues for
692
+ this repository. If ``False``, disable issues for this repository.
693
+ API default: ``None`` - leave value unchanged.
694
+ :param bool has_wiki: (optional), If ``True``, enable the wiki for
695
+ this repository. If ``False``, disable the wiki for this
696
+ repository. API default: ``None`` - leave value unchanged.
697
+ :param bool has_downloads: (optional), If ``True``, enable downloads
698
+ for this repository. If ``False``, disable downloads for this
699
+ repository. API default: ``None`` - leave value unchanged.
700
+ :param str default_branch: (optional), If not ``None``, change the
701
+ default branch for this repository. API default: ``None`` - leave
702
+ value unchanged.
695
703
:returns: bool -- True if successful, False otherwise
696
704
"""
697
- data = dumps ({'name' :name ,'description' :description ,
698
- 'homepage' :homepage ,'private' :private ,
699
- 'has_issues' :has_issues ,'has_wiki' :has_wiki ,
700
- 'has_downloads' :has_downloads ,
701
- 'default_branch' :default_branch })
705
+ edit = {'name' :name }
706
+ if description is not None :
707
+ edit ['description' ]= description
708
+ if homepage is not None :
709
+ edit ['homepage' ]= homepage
710
+ if private is not None :
711
+ edit ['private' ]= private
712
+ if has_issues is not None :
713
+ edit ['has_issues' ]= has_issues
714
+ if has_wiki is not None :
715
+ edit ['has_wiki' ]= has_wiki
716
+ if has_downloads is not None :
717
+ edit ['has_downloads' ]= has_downloads
718
+ if default_branch is not None :
719
+ edit ['default_branch' ]= default_branch
720
+
721
+ data = dumps (edit )
702
722
json = self ._json (self ._patch (self ._api ,data = data ),200 )
703
723
if json :
704
724
self ._update_ (json )