@@ -10,31 +10,53 @@ support the requested operation, an exception will be thrown.
1010Create
1111------
1212
13- Resources can be created via ``create `` method. Each resource supports different keyword
14- arguments. Unfortunately Redmine doesn't support the creation of some resources via REST
15- API. You can read more about it in each resource's documentation.
13+ Python Redmine provides 2 create operation methods: ``create `` and ``new ``. Unfortunately Redmine
14+ doesn't support the creation of some resources via REST API. You can read more about it in each
15+ resource's documentation.
16+
17+ create
18+ ++++++
19+
20+ Creates new resource with given fields and saves it to the Redmine.
1621
1722.. code-block :: python
1823
1924 >> > project = redmine.project.create(name = ' Vacation' , identifier = ' vacation' , description = ' foo' , homepage = ' http://foo.bar' , is_public = True , parent_id = 345 , inherit_members = True , custom_field_values = {2 : ' foobar' })
2025 >> > project
2126 < redmine.resources.Project # 123 "Vacation">
2227
28+ new
29+ +++
30+
31+ Creates new empty resource but doesn't save it to the Redmine. This is useful if you want to
32+ set some resource fields later based on some condition(s) and only after that save it to the
33+ Redmine.
34+
35+ .. code-block :: python
36+
37+ >> > project = redmine.project.new()
38+ >> > project.name = ' Vacation'
39+ >> > project.identifier = ' vacation'
40+ >> > project.description = ' foo'
41+ >> > project.is_public = True
42+ >> > project.inherit_members = True
43+ >> > project.save()
44+ True
45+
2346 Read
2447----
2548
2649Python Redmine provides 3 read operation methods: ``get ``, ``all `` and ``filter ``. Each
2750of this methods support different keyword arguments depending on the resource used and
2851method called. You can read more about it in each resource's documentation.
2952
30- Get
53+ get
3154+++
3255
3356Returns requested Resource object either by integer ``id `` or by string ``identifier ``:
3457
3558.. code-block :: python
3659
37- >> > redmine = Redmine(' http://demo.redmine.org' )
3860 >> > project = redmine.project.get(' vacation' )
3961 >> > project.name
4062 ' Vacation'
@@ -69,26 +91,24 @@ Returns requested Resource object either by integer ``id`` or by string ``identi
6991
7092 redmine.project.get(' vacation' ).refresh()
7193
72- All
94+ all
7395+++
7496
7597Returns a ResourceSet object that contains all the requested Resource objects:
7698
7799.. code-block :: python
78100
79- >> > redmine = Redmine(' http://demo.redmine.org' )
80101 >> > projects = redmine.project.all()
81102 >> > projects
82103 < redmine.resultsets.ResourceSet object with Project resources>
83104
84- Filter
105+ filter
85106++++++
86107
87108Returns a ResourceSet object that contains Resource objects filtered by some condition(s):
88109
89110.. code-block :: python
90111
91- >> > redmine = Redmine(' http://demo.redmine.org' )
92112 >> > issues = redmine.issue.filter(project_id = ' vacation' )
93113 >> > issues
94114 < redmine.resultsets.ResourceSet object with Issue resources>
@@ -143,13 +163,13 @@ Returns a ResourceSet object that contains Resource objects filtered by some con
143163
144164 .. code-block :: python
145165
146- length = len (redmine.project.all())
166+ len (redmine.project.all())
147167
148168 * **list() **. Force evaluation of a ResourceSet by calling list() on it.
149169
150170 .. code-block :: python
151171
152- projects = list (redmine.project.all())
172+ list (redmine.project.all())
153173
154174 * **Index **. A ResourceSet is also evaluated when you request some of it's Resources by index.
155175
@@ -171,7 +191,7 @@ of some resources via REST API. You can read more about it in each resource's do
171191.. code-block :: python
172192
173193 >> > redmine.project.delete(1 )
174- >> > True
194+ True
175195
176196 .. warning ::
177197
0 commit comments