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

self.redmine.engine.request returns bool #182

Closed
nk2017ffm opened this Issue Jul 28, 2017 · 5 comments

Comments

2 participants
@nk2017ffm

nk2017ffm commented Jul 28, 2017

I get this confusing result from a redmine.wiki_page.create( )

Traceback (most recent call last):
  File "./restore_basic.py", line 237, in <module>
    read_lines(args)
  File "./restore_basic.py", line 201, in read_lines
    handle_controller_wiki(action, fmt, idx, lines, controller)
  File "./restore_basic.py", line 147, in handle_controller_wiki
    create_wiki_page(project_id, id, content_text)
  File "./restore_basic.py", line 99, in create_wiki_page
    text=content_text,
  File "/home/kn/git/redmine-restore/virtualenv/lib/python3.5/site-packages/redminelib/managers.py", line 181, in create
    resource = self.to_resource(response[self.container])
TypeError: 'bool' object is not subscriptable

Response being bool (True) doesn't seem right:

response = self.redmine.engine.request(self.resource_class.http_method_create, url, data=data)
resource = self.to_resource(response[self.container])

The API itself works, I could create projects, and the projects have wikis.

@nk2017ffm

This comment has been minimized.

nk2017ffm commented Jul 28, 2017

The problem seems to be in engines.base

        if status_code in (200, 201):                                                            
            if return_raw:                                                                       
                return response                                                                  
            elif not response.content.strip():                                                   
                return True                                                                      
            else:                                                                                
                try:                                                                             
                    return response.json()                                                       
                except (ValueError, TypeError):                                                  
                    raise exceptions.JSONDecodeError(response)   

Return code is indeed 200, and response.content is b''. Redmine version is 3.0, 3.020140825-8deb8u4

@nk2017ffm nk2017ffm closed this Jul 28, 2017

@nk2017ffm

This comment has been minimized.

nk2017ffm commented Jul 28, 2017

My bad, I misread the supported version.

@nk2017ffm nk2017ffm reopened this Jul 28, 2017

@nk2017ffm

This comment has been minimized.

nk2017ffm commented Jul 28, 2017

This happens when a page already exists.

@maxtepkeev

This comment has been minimized.

Owner

maxtepkeev commented Jul 28, 2017

That's weird. Thanks for the report, I'll have a look at this.

@maxtepkeev maxtepkeev self-assigned this Jul 28, 2017

@maxtepkeev maxtepkeev added the bug label Jul 28, 2017

maxtepkeev added a commit that referenced this issue Jan 6, 2018

@maxtepkeev

This comment has been minimized.

Owner

maxtepkeev commented Jan 6, 2018

Fixed in 1ad0838. Will be part of next release.

@maxtepkeev maxtepkeev closed this Jan 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment