Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving of user.custom_fields #39

Closed
nikitachukov opened this issue Jul 31, 2014 · 2 comments
Closed

Saving of user.custom_fields #39

nikitachukov opened this issue Jul 31, 2014 · 2 comments
Assignees
Labels
bug

Comments

@nikitachukov
Copy link

@nikitachukov nikitachukov commented Jul 31, 2014

Hello!

How i can save custom_fields of user object?

from redmine import Redmine
redmine = Redmine('http://redmine.gosznak.ru/', username='admin', password='password',version='2.4.2')
user = redmine.user.new()
user.login = 'Login'
user.firstname = 'Name'
user.lastname = 'LastName_byScrypt'
user.mail = 'mail@mail.ru'
user.auth_source_id = 1
user.custom_fields={'id': 1,'description': 'foo'}
user.save()

Traceback (most recent call last):
File "C:/Users/chukovna/Desktop/xxx", line 9, in
user.custom_fields={'id': 1,'description': 'foo'}
File "C:\Python27\lib\site-packages\redmine\resources.py", line 173, in setattr
raise ReadonlyAttrError()
ReadonlyAttrError: Can't set read only attribute

@maxtepkeev
Copy link
Owner

@maxtepkeev maxtepkeev commented Jul 31, 2014

Hi!

This is a bug in python-redmine, well, not really a bug actually, but my mistake ;-) I will release a new version with a fix ASAP (probably tomorrow).

In the meantime you can user this as a workaround:

redmine.user.create(
    login='jsmith',
    password='qwerty',
    firstname='John',
    lastname='Smith',
    mail='john@smith.com',
    auth_source_id=1,
    custom_fields=[{'id': 1, 'value': 'some_value'}]
)

Thanks for reporting this!

@maxtepkeev maxtepkeev added the bug label Jul 31, 2014
@maxtepkeev maxtepkeev self-assigned this Jul 31, 2014
maxtepkeev added a commit that referenced this issue Aug 1, 2014
@maxtepkeev
Copy link
Owner

@maxtepkeev maxtepkeev commented Aug 1, 2014

Fixed in v0.8.3

@maxtepkeev maxtepkeev closed this Aug 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.