Coder Social home page Coder Social logo

python-redmine's People

Contributors

0x55aa avatar aaloy avatar andreiavram avatar batrick avatar bdrung avatar digenis avatar doezer avatar galaf avatar hjpotter92 avatar hsum avatar loechel avatar maxtepkeev avatar mgorny avatar misilot avatar niwatolli3 avatar rconradharris avatar rczajka avatar s3rvac avatar timgates42 avatar uspike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-redmine's Issues

Повторное использование параметров прошлого объекта при создании нового

Как воспроизвести:

  1. Делаем задачу:
issue_1 = redmine.issue.new()
issue_1.project_id = 1
issue_1.tracker_id = 2
issue_1.subject = 'Issue 1'
issue_1.description = 'Issue 1'
issue_1.save()

В redmine отправляется:

  Parameters: {"issue"=>{"description"=>"Issue 1", "tracker_id"=>2, "subject"=>"Issue 1"}, "key"=>"...", "project_id"=>"1"}

Создаем новую задачу, зададим у неё только subject и сохраним её:

issue_2 = redmine.issue.new()
issue_2.subject = 'Issue 2'
issue_2.save()

В redmine отправляется:

Parameters: {"issue"=>{"description"=>"Issue 1", "tracker_id"=>2, "subject"=>"Issue 2"}, "key"=>"...", "project_id"=>"1"}

Все параметры, которые не были переопределены для нового объекта issue_2 были "скопированы" с объекта issue_1, чего на мой взгляд быть не должно.

Unable to upload files

I have created a small file and tried the following:
import redmine
redmine_srv = redmine.Redmine(REDMINE_SERVER, key=APIKEY)
issue = redmine_srv.issue.get(3961)
redmine_srv.issue.update(3961, subject=issue.subject+'0', uploads=[{'path': r'C:\Users\jsmith\Perforce\redmine_main\migrations\test.txt'}])

When I look in Redmine I can see that the subject has been properly updated but there is no file attached. I am able to attach the file by hand.

Error cathing an exception

If I try to catch an exception as with

try:
redmine.issue.create(**rec)
except redmine.exceptions.ValidationError, err:
print 'My error check'

I get a new exception raised:
redmine.exceptions.ResourceError: Unsupported redmine resource

Option to fail silently when resource optional but valid attr is not set

Currently, if trying to access resource.attr when the attr is not set on the resource will raise an exception.

This is useful when trying to access an invalid attribute for a given resource, like "issue.date_due" instead of "issue.due_date". But this exception is also thrown up when the given attr is not set on the resource, even though it is valid for the given resource (for example, if due date is not set, issue.due_date will raise an exception.

One could always wrap code in try catch statements, but this might be impractical, especially in contexts when this is not as easy to do (for example, in django template code)

Need a way to obtain the current user

There is a need for an easy way to get the current user. Currently I haven't found any way to get the current user or it's ID in case of a connection with API key. If the login is done with username, it's possible to find it with filter but need some care to ensure we don't have a false positive.

Cannot save Time Entries

Hi, I'm using this module and I think it's really good, but I'm having a problem saving Time Entries.

This is the cut&paste from python terminal:

>>> from redmine import Redmine
>>> rm = Redmine(url,key=api_key)
>>> tes = rm.time_entry.filter(from_date='2014-04-18', to_date='2014-04-18')
>>> te = tes[0]
>>> te.hours
1.0
>>> te.comments
u'prova'
>>> te.comments = 'riprova'
>>> te.comments
'riprova'
>>> te.comments = u'riprova'
>>> te.comments
u'riprova'
>>> te.save()
True
>>> tes = rm.time_entry.filter(from_date='2014-04-18', to_date='2014-04-18')
>>> te = tes[0]
>>> te.comments
u'prova'
>>> 
KeyboardInterrupt
>>> te
<redmine.resources.TimeEntry #4997>
>>> te.comments
u'prova'
>>> 

and

>>> rmte = rm.time_entry.new()
>>> rmte.issue_id=5574
>>> rmte.spent_on='2014-04-18T00:06:26Z'
>>> rmte.hours=1
>>> rmte.save()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/redmine/resources.py", line 227, in save
    for item, value in self.manager.create(**self._changes):
  File "/usr/local/lib/python2.7/dist-packages/redmine/managers.py", line 175, in create
    resource = self.to_resource(response[self.container])
KeyError: 'time_entry'
>>> 

I'm using Python 2.7.5+ and this environment of Redmine:

Environment:
  Redmine version                          2.2.3.stable.11535
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.12
  Environment                              production
  Database adapter                         Mysql2

Am I doing something wrong?

time_entry.filter(user_id=X) seems to be ignored (ChiliProject 3.2)

Hi again,

when trying to filter time entries based on user_id, it seems the option is ignored. Now, unlike my previous issue, it is important to say that user_id filter DOES NOT work with the REST API of my ChiliProject, either.

The reason why I am asking this anyway is that the python-redmine docs say that this filter exists, but the Redmine REST API documentation does not mention it.

So, does it work with Redmine? If yes, is there a way to make it work with ChiliProject or is that project too long dead?

Many thanks.

allow "exporting" data from redmine

Hi,

I want to export a wiki as html instead of redmine wiki format, basically just need to request the wiki page with .html and return it raw instead of decoded json and it works, i looked at the code a little and it seems it would need some tweaks across to be able to do this.

I will look into it myself but let me know if you think you can implement this easily so i don't waste too much time.

Thanks!

activate tracker in project

hi there,
is it possible to create/update a project and define trackers and/or custom fields that should be activated in this project?

What are all filter operations for issues

I found this in the documentation for filtering issues

issues = redmine.issue.filter(
    project_id='vacation',
    subproject_id='!*', 
    created_on='><2012-03-01|2012-03-07',
    sort='category:desc
)

I see that you have ><fromdate|todate
Is there a listing somewhere of all of the available operators

For my specific case I want to do an in or or operation such as

redmine.issue.filter(
    project_id='vacation',
    author_id='in5,6', # Not sure what to put here to do an IN or OR operation
)

Required field in filter are not really required

The parameter project_id for issue.filter is noted as required in the doc:

  • project_id (integer or string) – (required). Id or identifier of issue’s project.
    But in reality it isn't required when we look at the official redmine api doc : http://www.redmine.org/projects/redmine/wiki/Rest_Issues
    In the exemple we can have a request that is 'GET /issues.xml?assigned_to_id=6'

So I've tried it with the python-redmine lib and 'redmine.issue.filter(assigned_to_id='me', status_id="open")' does work well.

This should then be fix in the doc, and most other required parameters in filter should be checked for validity as well.

Thanks for this great lib, it work very well when all problem found only come from the doc!

Package version unavailable

Most packages make their version available in the version property. I have been unable to figure out how to get the python-redmine package version from the package. Is there a way?

truncated uploads with issues

Hi,

I'm seeing something strange which i haven't been able to pinpoint, if i upload a file via the webpage on redmine its fine but when i upload it from the api using python-redmine sometimes the file upload seems to cut and theres a few missing kb of the file which means images are missing the bottom part for example.

Any idea what i could be before i keep banging my head?

Thanks.

How to get subjects of subtasks (children)

Hi there,

we updated your fix by download the zip, but we still can't get what we need. We've tried the following:

issue = redmine.issue.get(105)
issue.children.total_count
1
issue.children.get(264)
<redmine.resources.Issue #264 "五月協助輔導員舉辦助理集訓">
len(list(issue.children.manager.all()))
106
len(list(issue.children.manager.filter(include = 'children')))
106

we have to specify the id of the subtask to get it (in this case, it's 264). But we would like to get all of them, how do we do that? When we use manger.all like above, it delivers all the tasks, but we just want "all the subtasks". We can't find it in the documentation.

please advice, thank you.

Redmine returned internal error

Code is very simple
issues = redmine.issue.filter(tracker_id=0, status_id = "open")
issueList = list(issues)

issueList = list(issues)

File "c:\Python34\lib\site-packages\redmine\resultsets.py", line 72, in __iter
__
offset=self.manager.params.get('offset', self.offset)
File "c:\Python34\lib\site-packages\redmine\managers.py", line 58, in retrieve

response = self.redmine.request('get', self.url, params=dict(self.params, li

mit=limit, offset=offset))
File "c:\Python34\lib\site-packages\redmine__init__.py", line 98, in request
raise ServerError()
redmine.exceptions.ServerError: Redmine returned internal error, perhaps you are
doing something wrong

Please, what is this strange error ?

I can not change the version of an issue

Hello,
I tried to change the targetVersion field of an issue with this code:

from redmine import Redmine
from redmine.exceptions import ResourceAttrError
redmine = Redmine('https://xxxxxx', username='kjhkjh', password='ksqjhdsqkdjh')
project = redmine.project.get('Essai')
project.issues.manager.update(46355,fixed_version_id = 0)

My Authentification is correct.
Code dont provoks any error, but field is not modified.
How can I change the TargetVersion field ? Is it possible to provide a string insteed of a version_id ?

Thanks

question of Issues

Hi,

I would like to access "parent_issued_id" in a single issue in order to collect Issues according to their parent Issues. However, I cannot find that
attributes in Issue. I am a novice of Python and Redmine. Here is my code

>>>from redmine import Redmine
>>>redmine = Redmine(g_redmine_url, key=g_redmine_key, requests={'verify': False})
>>>project = redmine.project.get(g_redmine_project)
>>>issues  = list(project.issues)
>>> dir(issues[0])
[u'assigned_to', 'attachments', u'author', u'category', 'changesets', 'children', u'created_on', u'description', u'done_ratio', u'due_date', u'id', 'journals', u'priority', u'project', 'relations', u'start_date', u'status', u'subject', 'time_entries', u'tracker', u'updated_on', 'watchers']
>>> fi=issues[0]
>>> fi.id
206
>>> fi.assigned_to
<redmine.resources.User #16 "Jeong Han Lee">
>>> fi.attachments
<redmine.resultsets.ResourceSet object with Attachment resources>
>>> fi.author
<redmine.resources.User #16 "Jeong Han Lee">
>>> fi.category
<redmine.resources.IssueCategory #14 "Control SW">
>>> fi.changesets
[]
>>> fi.created_on
datetime.datetime(2014, 4, 2, 2, 5, 8)
>>> fi.description
u'test'
>>> fi.done_ratio
20
>>> fi.due_date
datetime.date(2014, 4, 17)
>>> fi.id
206
>>> fi.journals
<redmine.resultsets.ResourceSet object with IssueJournal resources>
>>> fi.priority
<redmine.resources.Enumeration #4 "Normal">
>>> fi.project
<redmine.resources.Project #52 "Fouth Year Plan">
>>> fi.relations
<redmine.resultsets.ResourceSet object with IssueRelation resources>
>>> fi.start_date
datetime.date(2014, 4, 2)
>>> fi.status
<redmine.resources.IssueStatus #2 "In Progress">
>>> fi.subject
u'test issue for redmine python script'
>>> fi.time_entries
<redmine.resultsets.ResourceSet object with TimeEntry resources>
>>> fi.tracker
<redmine.resources.Tracker #13 "Activity">
>>> fi.updated_on
datetime.datetime(2014, 4, 2, 2, 5, 8)
>>> fi.watchers

As you expect,

>>> fi.parent_issue_id
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/redmine/resources.py", line 357, in __getattr__
    return super(Issue, self).__getattr__(item)
  File "/usr/local/lib/python2.7/dist-packages/redmine/resources.py", line 166, in __getattr__
    return self._action_if_attribute_absent()
  File "/usr/local/lib/python2.7/dist-packages/redmine/resources.py", line 264, in _action_if_attribute_absent
    raise ResourceAttrError()
redmine.exceptions.ResourceAttrError: Resource doesn't have the requested attribute

I was trying to look at resource.py, and realized quickly to ask this question to developers.

Thanks,
Han

Setting other information

We are using this tool to write a converter from a different issue tracking system into Redmine. We want to keep as much of the original information as possible without using custom fields.
Is there a way to set the Author, Submit Date, and the Close Date?

project.issues does not return all issues

Hi,

Using Redmine 2.4.2.stable and latest python-redmine, when trying to retrieve all the issues using the following code:

project = redmine.project.get("my_proj")
issues = project.issues

I get a list of 25 unique issues, repeating itself 21 times so that len(issues) = 21 * 25.

Thanks,
Ido.

ServerError - how to analyze problem

Hi,
I'm having a problem retrieving issues from my server:

>>> from redmine import Redmine
>>> rm = Redmine(my_url,key=my_key)
>>> issue = rm.issue.get(5658)
>>> issue.parent
<redmine.resources.Issue #5559>
>>> issues = rm.issue.filter(project_id = my_project_name)
>>> issues
<redmine.redmine.redmine.resultsets.ResourceSet object with Issue resources>
>>> issues.get(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/redmine/redmine/redmine/resultsets.py", line 22, in get
    for resource in self:
  File "/usr/local/lib/python2.7/dist-packages/redmine/redmine/redmine/resultsets.py", line 72, in __iter__
    offset=self.manager.params.get('offset', self.offset)
  File "/usr/local/lib/python2.7/dist-packages/redmine/redmine/managers.py", line 58, in retrieve
    response = self.redmine.request('get', self.url, params=dict(self.params, limit=limit, offset=offset))
  File "/usr/local/lib/python2.7/dist-packages/redmine/__init__.py", line 98, in request
    raise ServerError()
redmine.redmine.exceptions.ServerError: Redmine returned internal error, perhaps you are doing something wrong

Maybe I'm having some issue in the Redmine server, where should I start to analyze?

Thanks

issue.upload - "Requested resource doesn't exist"

Hi there,
I've encountered an issue when creating a new issue.

    issue = redmine.issue.new()
    issue.project_id = '%s' % project
    issue.subject = subject
    issue.description = description
    issue.save()

Works without any issue.

But, if I also include a file to upload along with the ticket, I receive a "Requested resource does not exist" error.

    issue = redmine.issue.new()
    issue.project_id = '%s' % project
    issue.subject = subject
    issue.description = description
    issue.uploads = [{'path': '/path/to/file.txt'}]
    issue.save()

I have ensured that the file does exist with an os.path.exists() call. Here's some of the stack trace:

 86             raise AuthError()
 87         elif response.status_code == 404:

-> 88 raise ResourceNotFoundError
89 elif response.status_code == 409:
90 raise ConflictError

Would anything immediately seem suspicious? I'm creating a Redmine object with a user's API key, rather than an explicit username/passwd.

Many thanks Max,
Eoghan

filter custom field

Hi,
if I filter issues by a custom field I am getting all issues returned if the project dosen't use this custom field

example:
if I got two projects, p1 and p2 with each 10 issues and only p2 is using my custom field cf which is always empty (with id 1)

for project in redmine.project.all():
    print project.name, len(redmine.issue.filter(project_id=project.id, subproject_id='!*', cf_1="random"))

the result is:

p1 10
p2 0

I would expect that both results are 0 or an exception for p1

Can't upload attachments with .save in .new

This happens when the following code is run
issue.requireditems_here

issue.uploads = [{'path': '/folder/folderDocuments/sample_37c8b57c0811b74f44c4ee0ae300b608.zip'}]
issue.save

This happens both with and without the patch

Traceback (most recent call last):
File "./kedmine.py", line 137, in
main()
File "./kedmine.py", line 125, in main
res = issue.save()
File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/resources.py", line 227, in save
for item, value in self.manager.create(**self._changes):
File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/managers.py", line 164, in create
fields['uploads'][index]['token'] = self.redmine.upload(upload.get('path', ''))
File "/Library/Python/2.7/site-packages/python_redmine-0.8.0-py2.7.egg/redmine/init.py", line 49, in upload
print response['upload']['token']
TypeError: 'NoneType' object has no attribute 'getitem'

Saving of user.custom_fields

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 = '[email protected]'
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

Using python-redmine with requests 0.14.2

Unfortunately I need to use requests version 0.14.2 on my machine, but python-redmine doesn't work with this version of requests:

Traceback (most recent call last):

File "hotcat.py", line 3, in
project = server.project.get('sl61')
File "/usr/local/lib/python2.7/dist-packages/redmine/managers.py", line 120, in get
return self.resource_class(self, self.retrieve()[0])
File "/usr/local/lib/python2.7/dist-packages/redmine/managers.py", line 58, in retrieve
response = self.redmine.request('get', self.url, params=dict(self.params, limit=limit, offset=offset))
File "/usr/local/lib/python2.7/dist-packages/redmine/init.py", line 82, in request
return response.json()
TypeError: 'dict' object is not callable

Is there any possibility to use requests 0.14.2 and python-redmine?

Trouble accessing issue journal notes

I have an application using python-redmine to access our Redmine instance; we use this application to automate some state management and make comments on Redmine issues based on pull requests to our enterprise Github. Recently, I've been seeing errors related to extracting journal notes. I really only started noticing the issues today, in conjunction with the 1.0.0 release, but I suspect that the issues been present for a few days now.

The main issue I've been seeing is with journal entries which document some change to the issue, such as a status change; I seem to be getting a ValueError with the following message: "dictionary update sequence element #0 has length 1; 2 is required". The code in question loops over the the issue journals and tries to add "journal.notes" to a list. (To make the application work, I currently have the stack trace suppressed through the use of a try/except block, so I don't have a good stack trace to include at the moment…)

This is a preliminary bug report; I'll try to look more deeply into exactly what errors I get and what the corresponding journal entry looks like, as I get time, but I wanted to go ahead and log the bug report in case you already have an idea of what the cause could be. If you have any specific information you'd like me to try to collect, please let me know about that as well.

how to get subtasks

Sorry, not sure if this is the right place to ask this question, but we hope to get some help.
If we have an issue, how do we grab the subtasks that belong to that issue?

We tried this:
for r in i.children.manager.filter(issue_id = i.id):
print(r)

and got this error:
RuntimeError: maximum recursion depth exceeded

If this is not the right place, hope you can direct me, thank you.

Can't get some custom fields

Hi

I have custom fields in redmine. And when I try to get
for issue in server.issue.filter(status_id='o', tracker_id='5', cf_20='Major' cf_38='Broken'):

I'll get only response with filter by cf_20 and without filtering by cf_38.

I also tried to restart redmine application, but this doesn't help.
I can't understand why it doesn't filter by new custom field (it is Searchable in settings)

Contact resource skype_name and website attributes unavailable

I am unable to update or get "skype_name" and "websites" attributes for contacts. Any attempt returns with a "ResourceAttrError: Resource doesn't have the requested attribute" error. The documentation shows them as possible fields for working with. Are they just not implemented yet? Thanks for your help.

Here's an example (running in ipython):

In [384]: redmine.contact.get(2150)
Out[387]: <redmine.resources.Contact #2150 "Speedway Auto Auction of Charlotte">
In [388]: mycontact = redmine.contact.get(2150)
In [392]: mycontact.skype_name
---------------------------------------------------------------------------
ResourceAttrError                         Traceback (most recent call last)
<ipython-input-397-4a7d32712701> in <module>()
----> 1 mycontact.skype_name

/usr/lib/python2.7/site-packages/redmine/resources.pyc in __getattr__(self, item)
    928             return manager.to_resource({'id': self._attributes[item].get('attachment_id', 0)})
    929 
--> 930         return super(Contact, self).__getattr__(item)
    931 
    932     def __setattr__(self, item, value):

/usr/lib/python2.7/site-packages/redmine/resources.pyc in __getattr__(self, item)
    185                 return ''
    186 
--> 187             return self._action_if_attribute_absent()
    188 
    189     def __setattr__(self, item, value):

/usr/lib/python2.7/site-packages/redmine/resources.pyc in _action_if_attribute_absent(self)
    286 
    287         if isinstance(raise_attr_exception, bool) and raise_attr_exception:
--> 288             raise ResourceAttrError
    289         elif isinstance(raise_attr_exception, (list, tuple)) and self.__class__.__name__ in raise_attr_exception:
    290             raise ResourceAttrError

ResourceAttrError: Resource doesn't have the requested attribute

When I attempt completion on a Contact resource, here are they options ipython gives me:

Possible completions are:
mycontact.address                      mycontact.company
mycontact.contacts                     mycontact.container_all
mycontact.container_create             mycontact.container_filter
mycontact.container_one                mycontact.container_update
mycontact.created_on                   mycontact.deals
mycontact.emails                       mycontact.first_name
mycontact.id                           mycontact.internal_id
mycontact.is_company                   mycontact.is_new
mycontact.issues                       mycontact.job_title
mycontact.last_name                    mycontact.middle_name
mycontact.notes                        mycontact.phones
mycontact.post_create                  mycontact.post_update
mycontact.pre_create                   mycontact.pre_update
mycontact.projects                     mycontact.query_all
mycontact.query_create                 mycontact.query_delete
mycontact.query_filter                 mycontact.query_one
mycontact.query_update                 mycontact.redmine_version
mycontact.refresh                      mycontact.requirements
mycontact.save                         mycontact.tag_list
mycontact.translate_params             mycontact.updated_on
mycontact.url                          mycontact.website

Running:

Environment:
  Redmine version                2.5.2.stable
  Ruby version                   1.9.3-p327 (2012-11-10) [x86_64-linux]
  Rails version                  3.2.19
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.11
  Git                            1.7.1
  Filesystem                     
Redmine plugins:
  clipboard_image_paste          1.8
  redmine_contacts               3.4.2
  redmine_issue_checklist        2.0.5
  redmine_jstoolbar_ext          0.2.0
  redmine_jstoolbar_ext_coderay  0.1.0
  redmine_knowledgebase          3.0.4
  redmine_rouge                  0.0.1
  redmine_wiki_extensions        0.6.4
  sidebar_hide                   0.0.5

Unable to save a new issue and custom fields ignored

I am using Python 2.7.5 with Requests 2.2.1 and Python-Redmine 0.6.0 running against a Redmine 2.3.0 server.

This works:
redmine = Redmine('http://redmine/', key='***')
issue = redmine.issue.create(project_id='lsdt', subject='Test 1')

This doesn't
issue = redmine.issue.new()
issue.project_id = 'lsdt'
issue.subject = 'Test 1'
issue.save()
which results in
redmine.exceptions.ResourceAttrError: Resource doesn't have the requested attribute

and no matter what I have tried with
issue = redmine.issue.create(project_id='lsdt', subject='Test 1', custom_fields=[{'TestField': 1}])
the field TestField is never populated. I have also tried using the update() method to update an existing one and it doesn't work.

date_from/date_to Filter

According to the docs, one can filter time entries from/to a specific date. I've tried with a few date formats, but it seems the filter does not work. What is the correct date format (according to the docs, a string)?

Unable to upload - ValueError: Unable to encode lists with elements that are not 2-tuples.

Hello. Nice bit of software here. Cheers!

I'm having problems uploading using issue.update. Redmine 1.4.4 (stock Debian package). Using python-redmine 0.8.2 and requests 0.12.1.

I can update notes just fine, but not files.

uploads is a set containing a dictionary:

[{'path': '/tmp/.../c212bb4acc0137287b4e8bfbd7464667/more_office_supplies.jpg', 'description': 'more_office_supplies.jpg', 'filename': 'more_office_supplies.jpg'}]

File "/home/........./....-portal/portal.py", line 213, in find_case
if server.issue.update(case_id, notes=note, uploads=uploads):
File "/usr/local/lib/python2.7/dist-packages/redmine/managers.py", line 195, in update
fields['uploads'][index]['token'] = self.redmine.upload(upload.get('path', ''))
File "/usr/local/lib/python2.7/dist-packages/redmine/init.py", line 48, in upload
response = self.request('post', url, data=stream, headers={'Content-Type': 'application/octet-stream'})
File "/usr/local/lib/python2.7/dist-packages/redmine/init.py", line 79, in request
response = getattr(requests, method)(url, *_kwargs)
File "/usr/share/pyshared/requests/api.py", line 85, in post
return request('post', url, data=data, *_kwargs)
File "/usr/share/pyshared/requests/api.py", line 40, in request
return s.request(method=method, url=url, **kwargs)
File "/usr/share/pyshared/requests/sessions.py", line 229, in request
r.send(prefetch=prefetch)
File "/usr/share/pyshared/requests/models.py", line 505, in send
body = self._encode_params(self.data)
File "/usr/share/pyshared/requests/models.py", line 326, in _encode_params
raise ValueError('Unable to encode lists with elements that are not 2-tuples.')
ValueError: Unable to encode lists with elements that are not 2-tuples.

Any suggestions how I should proceed? Thank you!

Download attachments/files

Is there support for downloading attachments or files from Redmine?
It doesn't look like it from what I can see.

I just want to check before I implement it in case I've missed it somewhere in the code

Unicode error when trying to acces resource.url

Resource let's say 'wiki_pages fails' to return url property when wiki.title contains french accents.
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 6: ordinal not in range(128)

  • wiki.query_one is utf8 encoded
  • wiki.title is unicode encoded

ex:

'{0}'.format(u"Une suite de caractères en français")

UnicodeEncodeError Traceback (most recent call last)
in ()
----> 1 '{0}'.format(u"Une suite de caractères en français")

patch in my version using

@property
def internal_id(self):
    return self.title.encode('utf8')

but query_one could also be unicode.

update custom field

Hi,
I was trying to update a date custom field. I am not getting an error, the return is actually true also the update time is set but it's not updating the field. I thought it may be a problem with the date field but it's also not working for integer or text fields.

example:
cf_1 = date
cf_2 = integer
cf_3 = text

redmine.issue.update(issue.id, cf_1='2014-04-17')
True
redmine.issue.update(issue.id, cf_2='20140417')
True
redmine.issue.update(issue.id, cf_3='20140417')
True

but the fields are still empty :(

Time Entry all()/filter() returns a fixed 25 items

Hi!

I have been experimenting a surprising behaviour, querying time entries.

It seems that the request always returns a maximum of 25 items, before taking limit/offset into account.

I get 43 time entries when I use the REST API:

https://MY_SERVER/time_entries.xml?from=2014-07-22

Let me clarify that with examples:

>>> time_entries = redmine.time_entry.filter(from_date="2014-07-22")
>>> len(time_entries)
25

>>> time_entries = redmine.time_entry.filter(from_date="2014-07-22", limit=24)
>>> len(time_entries)
24

>>> time_entries = redmine.time_entry.filter(from_date="2014-07-22", limit=25)
>>> len(time_entries)
25

>>> time_entries = redmine.time_entry.filter(from_date="2014-07-22", limit=26)
>>> len(time_entries)
25

>>> time_entries = redmine.time_entry.filter(from_date="2014-07-22", offset=24)
>>> len(time_entries)
1

>>> time_entries = redmine.time_entry.filter(from_date="2014-07-22", offset=25)
>>> len(time_entries)
0

This behaviour does not occur with, say, issues. I am using version 0.8.2 installed via pip.

Any idea what may be happening here? Am I doing something wrong?

Many thanks!

Add journal note to an issue

It would be great to add this to the documentation:

redmine.issue.update(issue_id, notes="A journal note")

It would be great as well to have it in a subclass like Watcher does.

Thanks very much for your library.

It is really useful for me. :)

values in the version--jinja2 can't get it.

Hi Max,

Here I come again. This time I am trying to get 'description' of the version, and the custom fields I made in the version. Can you tell me how to retrieve them?

Thanks,
Shu

SSL error, maybe you should add option to "ignore" SSL exception

Tryign to connect our redmine server:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/redmine/managers.py", line 98, in get
    return self.resource_class(self, self.retrieve())
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/redmine/managers.py", line 76, in retrieve
    return self.redmine.request('get', self.url, params=self.params)[self.container]
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/redmine/__init__.py", line 68, in request
    response = getattr(requests, method)(url, **kwargs)
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/requests/sessions.py", line 383, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/home/pafer/src/redmineadm/venv/lib/python2.7/site-packages/requests/adapters.py", line 389, in send
    raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Or maybe you've got other solution ? :)

Raise ForbiddenError when a 403 is encountered

If you a user doesn't have rights to a particular error, the code will currently raise an UnknownError with 403 embedded in the message.

To make this easier to handle, we should add a new exception ForbiddenError which the caller can use to catch handle appropriately.

How to get subjects of subtasks (children)

Hi Max,

Continue with this topic, now we have another need: we would like to get the subjects of the children tasks. We assumed each 'child' in the 'children' iterator was an issue, but we couldn't find subject. Can you help? Like the clip below, if I am able to get the subjects of the children tasks, I can make a very nice overview for the managers. Thank you, Shu.
subtasks

Limit/offset via kwargs is broken

I've tried with filter(limit=10) and other filters as is in the documentation, but always returns all the data, at some moment it looses the filter limit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.