File: standard.py

package info (click to toggle)
python-redmine 2.1.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 496 kB
  • sloc: python: 3,176; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 727 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Defines standard Redmine resources managers.
"""

from . import ResourceManager
from .. import exceptions


class WikiPageManager(ResourceManager):
    def _process_create_response(self, request, response):
        if response is True:
            raise exceptions.ValidationError('Resource already exists')  # issue #182

        return super(WikiPageManager, self)._process_create_response(request, response)


class FileManager(ResourceManager):
    def _process_create_response(self, request, response):
        if response is True:
            response = {self.container: {'id': int(request[self.container]['token'].split('.')[0])}}

        return super(FileManager, self)._process_create_response(request, response)