Passed
Push — master ( 5e306e...e48f16 )
by Jordi
04:40
created

bika.lims.setuphandlers.setupVarious()   A

Complexity

Conditions 2

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 23
rs 9.7
c 0
b 0
f 0
cc 2
nop 1
1
# -*- coding: utf-8 -*-
2
#
3
# This file is part of SENAITE.CORE
4
#
5
# Copyright 2018 by it's authors.
6
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
7
8
""" Bika setup handlers. """
9
10
from Products.CMFCore.utils import getToolByName
11
from Products.CMFPlone.utils import _createObjectByType
12
from bika.lims import logger
13
from bika.lims.catalog import getCatalogDefinitions
14
from bika.lims.catalog import setup_catalogs
15
from bika.lims.config import *
16
from bika.lims.interfaces import IARImportFolder, IHaveNoBreadCrumbs
17
from bika.lims.utils import tmpID
18
from zope.interface import alsoProvides
19
20
GROUPS = {
21
    # Dictionary {group_name: [roles]}
22
    "Analysts": ["Analyst", ],
23
    "Clients": ["Client", ],
24
    "LabClerks": ["LabClerk",],
25
    # TODO Unbound LabManagers from Manager role
26
    "LabManagers": ["LabManager", "Manager", ],
27
    "Preservers": ["Perserver", ],
28
    "Publishers": ["Publisher", ],
29
    "Verifiers": ["Verifier", ],
30
    "Samplers": ["Sampler", ],
31
    "RegulatoryInspectors": ["RegulatoryInspector", ],
32
    "SamplingCoordinators": ["SamplingCoordinator", ],
33
}
34
35
# noinspection PyClassHasNoInit
36
class Empty:
37
    pass
38
39
40
class BikaGenerator(object):
41
    def __init__(self):
42
        pass
43
44
    def setupPortalContent(self, portal):
45
        """ Setup Bika site structure """
46
        self.remove_default_content(portal)
47
        self.reindex_structure(portal)
48
49
        portal.bika_setup.laboratory.unmarkCreationFlag()
50
        portal.bika_setup.laboratory.reindexObject()
51
52
    def reindex_structure(self, portal):
53
        # index objects - importing through GenericSetup doesn't
54
        for obj_id in ('clients',
55
                       'batches',
56
                       'invoices',
57
                       'pricelists',
58
                       'bika_setup',
59
                       'methods',
60
                       'analysisrequests',
61
                       'referencesamples',
62
                       'supplyorders',
63
                       'worksheets',
64
                       'reports',
65
                       'arimports',
66
                       ):
67
            try:
68
                obj = portal[obj_id]
69
                obj.unmarkCreationFlag()
70
                obj.reindexObject()
71
            except AttributeError:
72
                pass
73
74
        for obj_id in ('bika_analysiscategories',
75
                       'bika_analysisservices',
76
                       'bika_attachmenttypes',
77
                       'bika_batchlabels',
78
                       'bika_calculations',
79
                       'bika_departments',
80
                       'bika_containers',
81
                       'bika_containertypes',
82
                       'bika_preservations',
83
                       'bika_identifiertypes',
84
                       'bika_instruments',
85
                       'bika_instrumenttypes',
86
                       'bika_instrumentlocations',
87
                       'bika_analysisspecs',
88
                       'bika_analysisprofiles',
89
                       'bika_artemplates',
90
                       'bika_labcontacts',
91
                       'bika_labproducts',
92
                       'bika_manufacturers',
93
                       'bika_sampleconditions',
94
                       'bika_samplematrices',
95
                       'bika_samplingdeviations',
96
                       'bika_samplepoints',
97
                       'bika_sampletypes',
98
                       'bika_srtemplates',
99
                       'bika_reflexrulefolder',
100
                       'bika_storagelocations',
101
                       'bika_subgroups',
102
                       'bika_suppliers',
103
                       'bika_referencedefinitions',
104
                       'bika_worksheettemplates'):
105
            try:
106
                obj = portal.bika_setup[obj_id]
107
                obj.unmarkCreationFlag()
108
                obj.reindexObject()
109
            except AttributeError:
110
                pass
111
112
    def remove_default_content(self, portal):
113
        # remove undesired content objects
114
        del_ids = []
115
        for obj_id in ['Members', 'news', 'events']:
116
            if obj_id in portal:
117
                del_ids.append(obj_id)
118
        if del_ids:
119
            portal.manage_delObjects(ids=del_ids)
120
121
    def setupGroupsAndRoles(self, portal):
122
        # Create groups
123
        groups_ids = portal.portal_groups.listGroupIds()
124
        groups_ids = filter(lambda gr: gr not in groups_ids, GROUPS.keys())
125
        for group_id in groups_ids:
126
            portal.portal_groups.addGroup(group_id, title=group_id,
127
                                          roles=GROUPS[group_id])
128
129
    def setupVersioning(self, portal):
130
        try:
131
            # noinspection PyUnresolvedReferences
132
            from Products.CMFEditions.setuphandlers import DEFAULT_POLICIES
133
        except ImportError:
134
            return
135
        portal_repository = getToolByName(portal, 'portal_repository')
136
        versionable_types = list(portal_repository.getVersionableContentTypes())
137
138
        for type_id in VERSIONABLE_TYPES:
139
            if type_id not in versionable_types:
140
                versionable_types.append(type_id)
141
                # Add default versioning policies to the versioned type
142
                for policy_id in DEFAULT_POLICIES:
143
                    portal_repository.addPolicyForContentType(
144
                        type_id, policy_id)
145
        portal_repository.setVersionableContentTypes(versionable_types)
146
147
    def setupCatalogs(self, portal):
148
        # an item should belong to only one catalog.
149
        # that way looking it up means first looking up *the* catalog
150
        # in which it is indexed, as well as making it cheaper to index.
151
152
        def addIndex(cat, *args):
153
            # noinspection PyBroadException
154
            try:
155
                cat.addIndex(*args)
156
            except:
157
                pass
158
159
        def addColumn(cat, col):
160
            # noinspection PyBroadException
161
            try:
162
                cat.addColumn(col)
163
            except:
164
                pass
165
166
        # create lexicon
167
        wordSplitter = Empty()
168
        wordSplitter.group = 'Word Splitter'
169
        wordSplitter.name = 'Unicode Whitespace splitter'
170
        caseNormalizer = Empty()
171
        caseNormalizer.group = 'Case Normalizer'
172
        caseNormalizer.name = 'Unicode Case Normalizer'
173
        stopWords = Empty()
174
        stopWords.group = 'Stop Words'
175
        stopWords.name = 'Remove listed and single char words'
176
        elem = [wordSplitter, caseNormalizer, stopWords]
177
        zc_extras = Empty()
178
        zc_extras.index_type = 'Okapi BM25 Rank'
179
        zc_extras.lexicon_id = 'Lexicon'
180
181
        # bika_catalog
182
183
        bc = getToolByName(portal, 'bika_catalog', None)
184
        if bc is None:
185
            logger.warning('Could not find the bika_catalog tool.')
186
            return
187
188
        # noinspection PyBroadException
189
        try:
190
            bc.manage_addProduct['ZCTextIndex'].manage_addLexicon(
191
                'Lexicon', 'Lexicon', elem)
192
        except:
193
            logger.warning('Could not add ZCTextIndex to bika_catalog')
194
            pass
195
196
        at = getToolByName(portal, 'archetype_tool')
197
        at.setCatalogsByType('Batch', ['bika_catalog', 'portal_catalog'])
198
        # TODO Remove in >v1.3.0
199
        at.setCatalogsByType('Sample', ['bika_catalog', 'portal_catalog'])
200
        # TODO Remove in >v1.3.0
201
        at.setCatalogsByType('SamplePartition',
202
                             ['bika_catalog', 'portal_catalog'])
203
        at.setCatalogsByType('ReferenceSample',
204
                             ['bika_catalog', 'portal_catalog'])
205
206
        addIndex(bc, 'path', 'ExtendedPathIndex', 'getPhysicalPath')
207
        addIndex(bc, 'allowedRolesAndUsers', 'KeywordIndex')
208
        addIndex(bc, 'UID', 'FieldIndex')
209
        addIndex(bc, 'SearchableText', 'ZCTextIndex', zc_extras)
210
        addIndex(bc, 'Title', 'ZCTextIndex', zc_extras)
211
        addIndex(bc, 'Description', 'ZCTextIndex', zc_extras)
212
        addIndex(bc, 'id', 'FieldIndex')
213
        addIndex(bc, 'getId', 'FieldIndex')
214
        addIndex(bc, 'Type', 'FieldIndex')
215
        addIndex(bc, 'portal_type', 'FieldIndex')
216
        addIndex(bc, 'created', 'DateIndex')
217
        addIndex(bc, 'Creator', 'FieldIndex')
218
        addIndex(bc, 'getObjPositionInParent', 'GopipIndex')
219
        addIndex(bc, 'title', 'FieldIndex', 'Title')
220
        addIndex(bc, 'sortable_title', 'FieldIndex')
221
        addIndex(bc, 'description', 'FieldIndex', 'Description')
222
        addIndex(bc, 'review_state', 'FieldIndex')
223
        addIndex(bc, 'Identifiers', 'KeywordIndex')
224
        addIndex(bc, 'is_active', 'BooleanIndex')
225
        addIndex(bc, 'BatchDate', 'DateIndex')
226
        addIndex(bc, 'getClientTitle', 'FieldIndex')
227
        addIndex(bc, 'getClientUID', 'FieldIndex')
228
        addIndex(bc, 'getClientID', 'FieldIndex')
229
        addIndex(bc, 'getClientBatchID', 'FieldIndex')
230
        addIndex(bc, 'getDateReceived', 'DateIndex')
231
        addIndex(bc, 'getDateSampled', 'DateIndex')
232
        addIndex(bc, 'getDueDate', 'DateIndex')
233
        addIndex(bc, 'getExpiryDate', 'DateIndex')
234
        addIndex(bc, 'getReferenceDefinitionUID', 'FieldIndex')
235
        addIndex(bc, 'getSampleTypeTitle', 'FieldIndex')
236
        addIndex(bc, 'getSampleTypeUID', 'FieldIndex')
237
238
        # https://github.com/senaite/senaite.core/pull/1091
239
        addIndex(bc, 'getSupportedServices', 'KeywordIndex')
240
        addIndex(bc, 'getBlank', 'BooleanIndex')
241
        addIndex(bc, 'isValid', 'BooleanIndex')
242
243
        addColumn(bc, 'path')
244
        addColumn(bc, 'UID')
245
        addColumn(bc, 'id')
246
        addColumn(bc, 'getId')
247
        addColumn(bc, 'Type')
248
        addColumn(bc, 'portal_type')
249
        addColumn(bc, 'creator')
250
        addColumn(bc, 'Created')
251
        addColumn(bc, 'Title')
252
        addColumn(bc, 'Description')
253
        addColumn(bc, 'sortable_title')
254
        addColumn(bc, 'getClientTitle')
255
        addColumn(bc, 'getClientID')
256
        addColumn(bc, 'getClientBatchID')
257
        addColumn(bc, 'getSampleTypeTitle')
258
        addColumn(bc, 'getDateReceived')
259
        addColumn(bc, 'getDateSampled')
260
        addColumn(bc, 'review_state')
261
262
        # bika_setup_catalog
263
264
        bsc = getToolByName(portal, 'bika_setup_catalog', None)
265
        if bsc is None:
266
            logger.warning('Could not find the setup catalog tool.')
267
            return
268
269
        # noinspection PyBroadException
270
        try:
271
            bsc.manage_addProduct['ZCTextIndex'].manage_addLexicon(
272
                'Lexicon', 'Lexicon', elem)
273
        except:
274
            logger.warning('Could not add ZCTextIndex to bika_setup_catalog')
275
            pass
276
277
        at = getToolByName(portal, 'archetype_tool')
278
        at.setCatalogsByType('Department',
279
                             ['bika_setup_catalog', "portal_catalog", ])
280
        at.setCatalogsByType('Container', ['bika_setup_catalog', ])
281
        at.setCatalogsByType('ContainerType', ['bika_setup_catalog', ])
282
        at.setCatalogsByType('AnalysisCategory', ['bika_setup_catalog', ])
283
        at.setCatalogsByType('AnalysisService',
284
                             ['bika_setup_catalog', 'portal_catalog'])
285
        at.setCatalogsByType('AnalysisSpec', ['bika_setup_catalog', ])
286
        at.setCatalogsByType('SampleCondition', ['bika_setup_catalog'])
287
        at.setCatalogsByType('SampleMatrix', ['bika_setup_catalog', ])
288
        at.setCatalogsByType('SampleType',
289
                             ['bika_setup_catalog', 'portal_catalog'])
290
        at.setCatalogsByType('SamplePoint',
291
                             ['bika_setup_catalog', 'portal_catalog'])
292
        at.setCatalogsByType('StorageLocation',
293
                             ['bika_setup_catalog', 'portal_catalog'])
294
        at.setCatalogsByType('SamplingDeviation', ['bika_setup_catalog', ])
295
        at.setCatalogsByType('IdentifierType', ['bika_setup_catalog', ])
296
        at.setCatalogsByType('Instrument',
297
                             ['bika_setup_catalog', 'portal_catalog'])
298
        at.setCatalogsByType('InstrumentType',
299
                             ['bika_setup_catalog', 'portal_catalog'])
300
        at.setCatalogsByType('InstrumentLocation',
301
                             ['bika_setup_catalog', 'portal_catalog'])
302
        at.setCatalogsByType('Method', ['bika_setup_catalog', 'portal_catalog'])
303
        at.setCatalogsByType('Multifile', ['bika_setup_catalog'])
304
        at.setCatalogsByType('AttachmentType', ['bika_setup_catalog', ])
305
        at.setCatalogsByType('Attachment', ['portal_catalog'])
306
        at.setCatalogsByType('Calculation',
307
                             ['bika_setup_catalog', 'portal_catalog'])
308
        at.setCatalogsByType('AnalysisProfile',
309
                             ['bika_setup_catalog', 'portal_catalog'])
310
        at.setCatalogsByType('ARTemplate',
311
                             ['bika_setup_catalog', 'portal_catalog'])
312
        at.setCatalogsByType('LabProduct',
313
                             ['bika_setup_catalog', 'portal_catalog'])
314
        at.setCatalogsByType('LabContact',
315
                             ['bika_setup_catalog', 'portal_catalog'])
316
        at.setCatalogsByType('Manufacturer',
317
                             ['bika_setup_catalog', 'portal_catalog'])
318
        at.setCatalogsByType('Preservation', ['bika_setup_catalog', ])
319
        at.setCatalogsByType('ReferenceDefinition',
320
                             ['bika_setup_catalog', 'portal_catalog'])
321
        at.setCatalogsByType('SRTemplate',
322
                             ['bika_setup_catalog', 'portal_catalog'])
323
        at.setCatalogsByType('SubGroup', ['bika_setup_catalog', ])
324
        at.setCatalogsByType('Supplier',
325
                             ['bika_setup_catalog', 'portal_catalog'])
326
        at.setCatalogsByType('Unit', ['bika_setup_catalog', ])
327
        at.setCatalogsByType('WorksheetTemplate',
328
                             ['bika_setup_catalog', 'portal_catalog'])
329
        at.setCatalogsByType('BatchLabel', ['bika_setup_catalog', ])
330
331
        addIndex(bsc, 'path', 'ExtendedPathIndex', 'getPhysicalPath')
332
        addIndex(bsc, 'allowedRolesAndUsers', 'KeywordIndex')
333
        addIndex(bsc, 'UID', 'FieldIndex')
334
        addIndex(bsc, 'SearchableText', 'ZCTextIndex', zc_extras)
335
        addIndex(bsc, 'Title', 'ZCTextIndex', zc_extras)
336
        addIndex(bsc, 'Description', 'ZCTextIndex', zc_extras)
337
        addIndex(bsc, 'id', 'FieldIndex')
338
        addIndex(bsc, 'getId', 'FieldIndex')
339
        addIndex(bsc, 'Type', 'FieldIndex')
340
        addIndex(bsc, 'portal_type', 'FieldIndex')
341
        addIndex(bsc, 'created', 'DateIndex')
342
        addIndex(bsc, 'Creator', 'FieldIndex')
343
        addIndex(bsc, 'getObjPositionInParent', 'GopipIndex')
344
        addIndex(bc, 'Identifiers', 'KeywordIndex')
345
346
        addIndex(bsc, 'title', 'FieldIndex', 'Title')
347
        addIndex(bsc, 'sortable_title', 'FieldIndex')
348
        addIndex(bsc, 'description', 'FieldIndex', 'Description')
349
350
        addIndex(bsc, 'review_state', 'FieldIndex')
351
352
        addIndex(bsc, 'getAccredited', 'FieldIndex')
353
        addIndex(bsc, 'getAnalyst', 'FieldIndex')
354
        addIndex(bsc, 'getBlank', 'FieldIndex')
355
        addIndex(bsc, 'getCalculationTitle', 'FieldIndex')
356
        addIndex(bsc, 'getCalculationUID', 'FieldIndex')
357
        addIndex(bsc, 'getCalibrationExpiryDate', 'FieldIndex')
358
        addIndex(bsc, 'getCategoryTitle', 'FieldIndex')
359
        addIndex(bsc, 'getCategoryUID', 'FieldIndex')
360
        addIndex(bsc, 'getClientUID', 'FieldIndex')
361
        addIndex(bsc, 'getDepartmentTitle', 'FieldIndex')
362
        addIndex(bsc, 'getDocumentID', 'FieldIndex')
363
        addIndex(bsc, 'getDuplicateVariation', 'FieldIndex')
364
        addIndex(bsc, 'getFormula', 'FieldIndex')
365
        addIndex(bsc, 'getFullname', 'FieldIndex')
366
        addIndex(bsc, 'getHazardous', 'FieldIndex')
367
        addIndex(bsc, 'getInstrumentLocationName', 'FieldIndex')
368
        addIndex(bsc, 'getInstrumentTitle', 'FieldIndex')
369
        addIndex(bsc, 'getInstrumentType', 'FieldIndex')
370
        addIndex(bsc, 'getInstrumentTypeName', 'FieldIndex')
371
        addIndex(bsc, 'getKeyword', 'FieldIndex')
372
        addIndex(bsc, 'getManagerEmail', 'FieldIndex')
373
        addIndex(bsc, 'getManagerName', 'FieldIndex')
374
        addIndex(bsc, 'getManagerPhone', 'FieldIndex')
375
        addIndex(bsc, 'getMaxTimeAllowed', 'FieldIndex')
376
        addIndex(bsc, 'getMethodID', 'FieldIndex')
377
        addIndex(bsc, 'getAvailableMethodUIDs', 'KeywordIndex')
378
        addIndex(bsc, 'getModel', 'FieldIndex')
379
        addIndex(bsc, 'getName', 'FieldIndex')
380
        addIndex(bsc, 'getPointOfCapture', 'FieldIndex')
381
        addIndex(bsc, 'getPrice', 'FieldIndex')
382
        addIndex(bsc, 'getSamplePointTitle', 'KeywordIndex')
383
        addIndex(bsc, 'getSamplePointUID', 'FieldIndex')
384
        addIndex(bsc, 'getSampleTypeTitle', 'FieldIndex')
385
        addIndex(bsc, 'getSampleTypeTitles', 'KeywordIndex')
386
        addIndex(bsc, 'getSampleTypeUID', 'FieldIndex')
387
        addIndex(bsc, 'getServiceUID', 'FieldIndex')
388
        addIndex(bsc, 'getServiceUIDs', 'KeywordIndex')
389
        addIndex(bsc, 'getTotalPrice', 'FieldIndex')
390
        addIndex(bsc, 'getUnit', 'FieldIndex')
391
        addIndex(bsc, 'getVATAmount', 'FieldIndex')
392
        addIndex(bsc, 'getVolume', 'FieldIndex')
393
        addIndex(bsc, 'is_active', 'BooleanIndex')
394
395
        addColumn(bsc, 'path')
396
        addColumn(bsc, 'UID')
397
        addColumn(bsc, 'id')
398
        addColumn(bsc, 'getId')
399
        addColumn(bsc, 'Type')
400
        addColumn(bsc, 'portal_type')
401
        addColumn(bsc, 'getObjPositionInParent')
402
403
        addColumn(bsc, 'Title')
404
        addColumn(bsc, 'Description')
405
        addColumn(bsc, 'title')
406
        addColumn(bsc, 'sortable_title')
407
        addColumn(bsc, 'description')
408
        addColumn(bsc, 'review_state')
409
        addColumn(bsc, 'getAccredited')
410
        addColumn(bsc, 'getInstrumentType')
411
        addColumn(bsc, 'getInstrumentTypeName')
412
        addColumn(bsc, 'getInstrumentLocationName')
413
        addColumn(bsc, 'getBlank')
414
        addColumn(bsc, 'getCalculationTitle')
415
        addColumn(bsc, 'getCalculationUID')
416
        addColumn(bsc, 'getCalibrationExpiryDate')
417
        addColumn(bsc, 'getCategoryTitle')
418
        addColumn(bsc, 'getCategoryUID')
419
        addColumn(bsc, 'getClientUID')
420
        addColumn(bsc, 'getDepartmentTitle')
421
        addColumn(bsc, 'getDuplicateVariation')
422
        addColumn(bsc, 'getFormula')
423
        addColumn(bsc, 'getFullname')
424
        addColumn(bsc, 'getHazardous')
425
        addColumn(bsc, 'getInstrumentTitle')
426
        addColumn(bsc, 'getKeyword')
427
        addColumn(bsc, 'getManagerName')
428
        addColumn(bsc, 'getManagerPhone')
429
        addColumn(bsc, 'getManagerEmail')
430
        addColumn(bsc, 'getMaxTimeAllowed')
431
        addColumn(bsc, 'getModel')
432
        addColumn(bsc, 'getName')
433
        addColumn(bsc, 'getPointOfCapture')
434
        addColumn(bsc, 'getPrice')
435
        addColumn(bsc, 'getSamplePointTitle')
436
        addColumn(bsc, 'getSamplePointUID')
437
        addColumn(bsc, 'getSampleTypeTitle')
438
        addColumn(bsc, 'getSampleTypeUID')
439
        addColumn(bsc, 'getServiceUID')
440
        addColumn(bsc, 'getTotalPrice')
441
        addColumn(bsc, 'getUnit')
442
        addColumn(bsc, 'getVATAmount')
443
        addColumn(bsc, 'getVolume')
444
445
        # portal_catalog
446
        pc = getToolByName(portal, 'portal_catalog', None)
447
        if pc is None:
448
            logger.warning('Could not find the portal_catalog tool.')
449
            return
450
        addIndex(pc, 'Analyst', 'FieldIndex')
451
        addColumn(pc, 'Analyst')
452
        # TODO: Nmrl
453
        addColumn(pc, 'getProvince')
454
        addColumn(pc, 'getDistrict')
455
456
        # Setting up all LIMS catalogs defined in catalog folder
457
        setup_catalogs(portal, getCatalogDefinitions())
458
459
    def setupTopLevelFolders(self, context):
460
        workflow = getToolByName(context, "portal_workflow")
461
        obj_id = 'arimports'
462
        if obj_id in context.objectIds():
463
            obj = context._getOb(obj_id)
464
            # noinspection PyBroadException
465
            try:
466
                workflow.doActionFor(obj, "hide")
467
            except:
468
                pass
469
            obj.setLayout('@@arimports')
470
            alsoProvides(obj, IARImportFolder)
471
            alsoProvides(obj, IHaveNoBreadCrumbs)
472
473
474
def create_CAS_IdentifierType(portal):
475
    """LIMS-1391 The CAS Nr IdentifierType is normally created by
476
    setuphandlers during site initialisation.
477
    """
478
    bsc = getToolByName(portal, 'bika_setup_catalog', None)
479
    idtypes = bsc(portal_type='IdentifierType', title='CAS Nr')
480
    if not idtypes:
481
        folder = portal.bika_setup.bika_identifiertypes
482
        idtype = _createObjectByType('IdentifierType', folder, tmpID())
483
        idtype.processForm()
484
        idtype.edit(title='CAS Nr',
485
                    description='Chemical Abstracts Registry number',
486
                    portal_types=['Analysis Service'])
487
488
489
def setupVarious(context):
490
    """
491
    Final Bika import steps.
492
    """
493
    if context.readDataFile('bika.lims_various.txt') is None:
494
        return
495
496
    site = context.getSite()
497
    gen = BikaGenerator()
498
    gen.setupGroupsAndRoles(site)
499
    gen.setupPortalContent(site)
500
    gen.setupTopLevelFolders(site)
501
    gen.setupVersioning(site)
502
    gen.setupCatalogs(site)
503
504
    # Plone's jQuery gets clobbered when jsregistry is loaded.
505
    setup = site.portal_setup
506
    setup.runImportStepFromProfile(
507
        'profile-plone.app.jquery:default', 'jsregistry')
508
    # setup.runImportStepFromProfile('profile-plone.app.jquerytools:default',
509
    #  'jsregistry')
510
511
    create_CAS_IdentifierType(site)
512