-
Notifications
You must be signed in to change notification settings - Fork 107
Had trouble with setting options for createProject #15
Comments
Hi there! thanks for your feedback! Im not sure I understand your problem, going by the documentation http://python-gitlab.readthedocs.org/ all the args to createProject() are strings so a simple: git.createProject("new project", public="1") Should work, I think. Can you explain it further? Im firing up a VM to install gitlab 6 and try the method to see if I can find the issue you are mentioning, will report back ASAP. Cheers! |
Sure, I'm using optparse for argument handling in a python 2.x script. I'm setting options in the script like My optparse looks like the following:
So I was creating a project like.....
Since I was passing a boolean it would be set as
|
https://github.com/Itxaka/python-gitlab/blob/master/gitlab/__init__.py#L267-L272 You could check for typing in your code and then auto convert it for the user passing the argument. e.g.
Utilize it like so...
And do the same for the public value. But again it's not that big of a deal. If you add it to your documentation I think it should be enough and note that booleans don't work in your documentation. Sometimes it's better to just document it. However you want to handle it is fine with me. |
Hi there, I was thinking maybe instead of using all args as strings, change them to int, at least for values that only have those options. I mean, it makes no sense tu use strings when the value is gonna be 1 or 0/true or false, like in the case of public or xxxID what do you think? |
I didn't know that it would straight up handle |
I tried to change it, let me know if it works now :) |
changed some args, could fix Issue #15
gitlabhq/gitlab-recipes#126
I was having trouble with setting new options for
git.createProject
. I was passing options to the function as booleans likeTrue
and I even triedstr(True)
. I found that the API is expecting a number such as0
or1
e.g.public=1
. I resolved that issue by writingstr(int(True))
.Not sure if you care to modify anything as it wasn't really a problem with your project. But it might confuse developers trying to develop against the API with
python-gitlab
. Perhaps it would be useful to add a documentation example forgit.createProject
where it is setting some options changing defaults.The text was updated successfully, but these errors were encountered: