forked from hforge/ikaaro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUPGRADE-0.75
195 lines (134 loc) · 4.97 KB
/
UPGRADE-0.75
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
!! THESE UPGRADE NOTES ARE WORK IN PROGRESS !!
**********************************************************************
Upgrade to ikaaro 0.75
System Administrators
**********************************************************************
Configuration file
==================
- Rename auth-cookie-expires to session-timeout
- Remove the profile-time and profile-space options (now they are
command line parameters for the icms-start.py script)
- New boolean option database-readonly
Update the database
====================
As usual instances must be updated following the standard procedure:
1. Make a backup
2. Update the database:
$ icms-update.py xxx
3. Rebuild the catalog:
$ icms-update-catalog.py xxx
**********************************************************************
Upgrade to ikaaro 0.75
Developers
**********************************************************************
Note that the documentation below is not complete. For any specific
problem, please ask the mailing list.
Imports
====================
Some things have changed names, or moved somewhere else. The table below
summarizes these changes:
Before Now
------------------------------------- ---------------------------------
ikaaro.buttons.RemoveButton ikaaro.buttons.Remove_BrowseButton
ikaaro.datatypes.Password ikaaro.datatypes.Password_Datatype
ikaaro.workflow **DELETED**
ikaaro.user ikaaro.users
ikaaro.user_views ikaaro.users_views
ikaaro.user.UserFolder ikaaro.users.Users
Simple patterns
=====================
(1) The resource methods 'get_asbapth()' and 'get_canonical_path()' have been
removed:
# Before
resource.get_abspath()
resource.get_canonical_path()
# Now
resource.abspath
(2) Root.init_resource has changed its signature:
# Before
class MyRoot(Root):
def init_resource(self, email, password, admins=('0',)):
super(MyRoot, self).init_resource(email, password, admins)
# Now
class MyRoot(Root):
def init_resource(self, email, password):
super(MyRoot, self).init_resource(email, password)
(3) The 'class_skin' variable does not include the 'ui' prefix now:
# Before
class_skin = 'ui/myskin'
# Now
class_skin = 'myskin'
Resources
=====================
(1) The 'class_schema' class variable has been replaced by fields. Now it is
easier to override a field:
# Before
class MyUser(User):
class_schema = User.class_schema.copy()
class_schema['age'] = Integer(source='metadata')
class_schema['firstname'] = class_schema['firstname'](mandatory=True)
del class_schema['lastname']
# Now
class MyUser(User):
age = Integer_Field # New field
firstname = User.firstname(required=True) # Override field
lastname = None # Remove field
Now a resource may have as many file-fields attached as desired (in the
example below the files will be named <name>.picture1, <name>.picture2,
<name>.curriculum.en, <name>.curriculum.fr, etc.):
# Now
class MyUser(User):
picture1 = File_Field
picture2 = File_Field
curriculum = HTMLFile_Field
Computed fields that are not stored but only used by the catalog (search) are
not declared anymore in the "class schema", but explicitly registered:
# Before
class MyFolder(Folder):
...
class_schema['foo'] = Integer(indexed=True)
# Now
class MyFolder(Folder):
...
from itools.database import register_field
register_field('age', Integer(indexed=True))
(2) The method '.get_property' now returns a property object, and not the
value anymore. Use instead '.get_value':
# Before
resource.get_property(name)
# Now
resource.get_value(name)
Views
=====================
Don't need to instantiate views anymore (this change is not required, just
recommended):
# Before
view = MyView()
# Now
view = MyView
Searching
=====================
(1) Now there are two programming interfaces to search the database, with and
without access control (respectively, high and low level). Most often the
high-level API will be used, choose carefully:
# Before
root.search(query)
# Now
context.search(query) # Option 1: with access control
context.database.search(query) # Option 2: without access control
(2) A new method allows to get the resources from a search directly:
# Before
resources = ( root.get_resource(brain.abspath)
for brain in results.get_documents() )
# Now
resources = results.get_resources()
Workflow
=====================
The workflow has been replaced by a Share property. All the resources have
the Share property, so you don't need to inherit from any particular class.
Usually you just need to remove any reference to the workflow code.
# Before
from ikaaro.workflow import WorkflowAware
class MyClass(WorkflowAware, Folder):
# Now
class MyClass(Folder):