{"action":"created","issue":{"url":"https://api.github.com/repos/python-gitlab/python-gitlab/issues/437","repository_url":"https://api.github.com/repos/python-gitlab/python-gitlab","labels_url":"https://api.github.com/repos/python-gitlab/python-gitlab/issues/437/labels{/name}","comments_url":"https://api.github.com/repos/python-gitlab/python-gitlab/issues/437/comments","events_url":"https://api.github.com/repos/python-gitlab/python-gitlab/issues/437/events","html_url":"https://github.com/python-gitlab/python-gitlab/issues/437","id":297223216,"number":437,"title":"Unable to set attributes on a user project","user":{"login":"alexwidener","id":3489076,"avatar_url":"https://avatars3.githubusercontent.com/u/3489076?v=4","gravatar_id":"","url":"https://api.github.com/users/alexwidener","html_url":"https://github.com/alexwidener","followers_url":"https://api.github.com/users/alexwidener/followers","following_url":"https://api.github.com/users/alexwidener/following{/other_user}","gists_url":"https://api.github.com/users/alexwidener/gists{/gist_id}","starred_url":"https://api.github.com/users/alexwidener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexwidener/subscriptions","organizations_url":"https://api.github.com/users/alexwidener/orgs","repos_url":"https://api.github.com/users/alexwidener/repos","events_url":"https://api.github.com/users/alexwidener/events{/privacy}","received_events_url":"https://api.github.com/users/alexwidener/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-14T19:50:17Z","updated_at":"2018-03-02T13:50:11Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hi,\r\n\r\nGitlab docs for what I'm trying to do:\r\nhttps://docs.gitlab.com/ce/api/projects.html#create-project-for-user\r\n\r\nI am unable to set project attributes for a UserProject. I can do this completely fine on a group project, but any of the following will not work:\r\n\r\n```\r\nproject_attributes = {\r\n    'wiki_enabled': False,\r\n    'name': 'project_name',\r\n    'description': 'some description'\r\n}\r\n\r\nself._active_user.projects.create(project_attributes)\r\n```\r\nThe above will not work if I put in wiki_enabled, but works fine with name and description. Additionally, works fine if it's a group project.\r\n\r\n```\r\nsetattr(project, 'wiki_enabled', False)\r\nproject.save()\r\n```\r\nThis will not work.\r\n\r\n```\r\ndata = {'wiki_enabled': False}\r\nproject.attributes.update(data)\r\nproject.save()\r\n```\r\nThis will not work either.\r\n\r\nWhat is the preferred way of setting attributes on a user project? \r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/python-gitlab/python-gitlab/issues/comments/369925543","html_url":"https://github.com/python-gitlab/python-gitlab/issues/437#issuecomment-369925543","issue_url":"https://api.github.com/repos/python-gitlab/python-gitlab/issues/437","id":369925543,"user":{"login":"gpocentek","id":1687888,"avatar_url":"https://avatars2.githubusercontent.com/u/1687888?v=4","gravatar_id":"","url":"https://api.github.com/users/gpocentek","html_url":"https://github.com/gpocentek","followers_url":"https://api.github.com/users/gpocentek/followers","following_url":"https://api.github.com/users/gpocentek/following{/other_user}","gists_url":"https://api.github.com/users/gpocentek/gists{/gist_id}","starred_url":"https://api.github.com/users/gpocentek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpocentek/subscriptions","organizations_url":"https://api.github.com/users/gpocentek/orgs","repos_url":"https://api.github.com/users/gpocentek/repos","events_url":"https://api.github.com/users/gpocentek/events{/privacy}","received_events_url":"https://api.github.com/users/gpocentek/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T13:50:11Z","updated_at":"2018-03-02T13:50:11Z","author_association":"COLLABORATOR","body":"Hi @alexwidener \r\n\r\nI've tested this on GitLab 10.5.2 and it worked as expected, so I guess the problem is related to the Gitlab server you're running (I've seen similar problems happen from time to time).\r\n\r\nI see 2 possible workarounds (untested):\r\n* do everything as an admin user but use `sudo`, something like: `gl.projects.create(project_attributes, sudo=self._active_user)`\r\n* or create the project the way you did, but then get a `Project` instance to manipulate the attribute:\r\n```python\r\nuser_project = self._active_user.projects.create(project_attributes)\r\np = gl.projects.get(user_project.id)\r\np.wiki_enabled = True\r\np.save()\r\n```"}}
{"actor":{"display_login":"gpocentek"}}