~launchpad-pqm/launchpad/devel

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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<!-- Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
     GNU Affero General Public License version 3 (see the file LICENSE).
-->

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
    i18n_domain="launchpad">

    <include file="servers.zcml" />
    <!-- Included via override-includes, as we are overriding a default
         Z3 component
    <include file="errorlog.zcml" />
    -->
    <include file="bug-5133.zcml" />

    <class class="lp.services.webapp.servers.LaunchpadBrowserRequest">
      <allow
        interface="
          lp.services.webapp.interfaces.ILaunchpadBrowserApplicationRequest"
        attributes="response locale __str__"
        />
    </class>

    <class class="lp.services.webapp.publisher.RedirectionView">
      <allow attributes="browserDefault __call__" />
    </class>

    <adapter
        for="zope.interface.Interface
             zope.publisher.interfaces.http.IHTTPRequest"
        provides="zope.traversing.browser.interfaces.IAbsoluteURL"
        factory="lp.services.webapp.publisher.CanonicalAbsoluteURL"
        />

    <adapter
        for="zope.publisher.interfaces.http.IHTTPRequest"
        provides="lp.services.webapp.interfaces.IDatabasePolicy"
        factory="lp.services.webapp.dbpolicy.LaunchpadDatabasePolicyFactory"
        />
    <adapter
        for="zope.publisher.interfaces.xmlrpc.IXMLRPCRequest"
        provides="lp.services.webapp.interfaces.IDatabasePolicy"
        factory="lp.services.webapp.dbpolicy.MasterDatabasePolicy"
        />
    <adapter
        for="lp.layers.WebServiceLayer"
        provides="lp.services.webapp.interfaces.IDatabasePolicy"
        factory="lp.services.webapp.dbpolicy.WebServiceDatabasePolicyFactory"
        />
    <adapter
        for="lp.layers.FeedsLayer"
        provides="lp.services.webapp.interfaces.IDatabasePolicy"
        factory="lp.services.webapp.dbpolicy.SlaveOnlyDatabasePolicy"
        />
    <adapter
        for="lp.layers.WebServiceLayer"
        provides="lazr.restful.interfaces.IWebBrowserOriginatingRequest"
        factory="lp.services.webapp.servers.web_service_request_to_browser_request"
        />
    <adapter
        for="lp.layers.WebServiceLayer"
        provides="lazr.restful.interfaces.INotificationsProvider"
        factory="lp.services.webapp.interfaces.INotificationRequest"
        />

    <!-- lazr.batchnavigator hook -->
    <adapter
        factory='.batching.FiniteSequenceAdapter' />

    <adapter
        factory='.batching.FiniteSequenceAdapter'
        for='storm.zope.interfaces.ISQLObjectResultSet' />

    <adapter
        factory='.batching.BoundReferenceSetAdapter'
        for='storm.references.BoundReferenceSet' />

    <adapter
        factory='.batching.BoundReferenceSetAdapter'
        for='storm.references.BoundIndirectReferenceSet' />

    <!-- links -->
    <class class="lp.services.webapp.menu.LinkData">
        <allow interface="lp.services.webapp.interfaces.ILinkData" />
    </class>

    <adapter
        for="lp.services.webapp.interfaces.ILinkData"
        provides="lp.services.webapp.interfaces.ILink"
        factory="lp.services.webapp.menu.MenuLink"
        />

    <adapter
        for="*"
        provides="lp.services.webapp.interfaces.IPrimaryContext"
        factory="lp.services.webapp.publication.DefaultPrimaryContext"
        />

    <class class="lp.services.webapp.menu.MenuLink">
        <require
            permission="zope.Public"
            interface="lp.services.webapp.interfaces.ILink"
            />
    </class>

    <adapter
        for="lp.services.webapp.interfaces.ILinkData"
        provides="lp.services.webapp.interfaces.IFacetLink"
        factory="lp.services.webapp.menu.FacetLink"
        />

    <class class="lp.services.webapp.menu.FacetLink">
        <require
            permission="zope.Public"
            interface="lp.services.webapp.interfaces.IFacetLink"
            />
    </class>

    <!-- Launchpad root object -->
    <utility
        provides="lp.services.webapp.interfaces.ILaunchpadRoot"
        component="lp.services.webapp.publisher.rootObject"
        />

    <adapter
        provides="lp.services.webapp.interfaces.ICanonicalUrlData"
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        factory="lp.services.webapp.publisher.LaunchpadRootUrlData"
        />

    <adapter
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        provides="lp.services.webapp.interfaces.ILaunchpadContainer"
        factory="lp.services.webapp.publisher.LaunchpadContainer"
        />

    <!-- Authentication. -->
    <utility
        component="lp.services.webapp.authentication.authService"
        provides="lp.services.webapp.interfaces.IPlacelessAuthUtility"
        permission="zope.Public"
        />

    <subscriber
        for="lp.services.webapp.interfaces.IPrincipalIdentifiedEvent"
        handler="lp.services.webapp.launchbag.set_login_in_launchbag_when_principal_identified"
        />

    <subscriber
        for="lp.services.webapp.interfaces.IPrincipalIdentifiedEvent"
        handler="lp.services.webservice.me.cache_me_link_when_principal_identified"
        />

    <subscriber
        for="zope.app.publication.interfaces.IBeforeTraverseEvent"
        handler="lp.services.webapp.launchbag.set_developer_in_launchbag_before_traversal"
        />

    <subscriber
        for="lp.services.webapp.interfaces.ILoggedOutEvent"
        handler="lp.services.webapp.launchbag.reset_login_in_launchbag_on_logout"
        />

    <subscriber
        for="lp.services.webapp.interfaces.ILoggedOutEvent"
        handler="lp.services.webapp.launchbag.reset_developer_in_launchbag_on_logout"
        />

    <utility
        factory="lp.services.webapp.authentication.SSHADigestEncryptor"
        provides="lp.services.webapp.interfaces.IPasswordEncryptor"
        permission="zope.Public"
        />

    <utility
        component="lp.services.webapp.authentication.loginSource"
        provides="lp.services.webapp.interfaces.IPlacelessLoginSource"
        permission="zope.Public"
        />

    <!-- Session machinery. -->
    <utility
        component="lp.services.webapp.session.idmanager"
        provides="zope.session.interfaces.IClientIdManager"
        />
    <utility
        component="lp.services.webapp.pgsession.data_container"
        provides="zope.session.interfaces.ISessionDataContainer"
        />

    <!-- Storm Store selector. -->
    <utility
        component="lp.services.webapp.adapter.StoreSelector"
        provides="lp.services.webapp.interfaces.IStoreSelector">
    </utility>

    <!-- Storm Store adapters, adapting a Storm subclass or instance
         to the correct Store for that tables replication set.
      -->
    <adapter
        provides="lp.services.database.lpstorm.IStore"
        for="zope.interface.Interface"
        factory="lp.services.webapp.adapter.get_store"
        />
    <adapter
        provides="lp.services.database.lpstorm.IMasterStore"
        for="zope.interface.Interface"
        factory="lp.services.webapp.adapter.get_master_store"
        />
    <adapter
        provides="lp.services.database.lpstorm.ISlaveStore"
        for="zope.interface.Interface"
        factory="lp.services.webapp.adapter.get_slave_store"
        />
    <!-- Universal adapter needed here per Bug #591841.
         We have no way of specifying that all subclasses of
         storm.locals.Storm implement an Interface. -->
    <adapter
        provides="lp.services.database.lpstorm.IMasterObject"
        for="zope.interface.Interface"
        trusted="yes"
        factory="lp.services.webapp.adapter.get_object_from_master_store"
        />
    <class class="storm.store.Store">
        <implements interface="lp.services.database.lpstorm.IStore" />
        <allow attributes="get" />
    </class>
    <class class="canonical.database.sqlbase.SQLBase">
        <implements interface="lp.services.database.lpstorm.IDBObject" />
    </class>

    <!-- Default favicon -->
    <browser:favicon for="*" file="../../../canonical/launchpad/images/launchpad.png" />

    <!-- LaunchBag Utility -->
    <utility
        factory="lp.services.webapp.launchbag.LaunchBag"
        provides="lp.services.webapp.interfaces.IOpenLaunchBag"
        permission="zope.Public"
        />

    <class class="lp.services.webapp.launchbag.LaunchBag">
        <require
            permission="zope.Public"
            interface="lp.services.webapp.interfaces.ILaunchBag"
            />
    </class>

    <!--
    Operational statistics. Note that these are publicly available,
    and if we want to restrict access to the LAN then we need to block
    these URLs in Apache.
    -->
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+opstats"
        permission="zope.Public"
        class="lp.services.webapp.opstats.OpStats"
        />
    <xmlrpc:view
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        class="lp.services.webapp.opstats.OpStats"
        methods="opstats"
        permission="zope.Public"
        name="+opstats"
        />

    <browser:page
        for="*"
        name="bag"
        template="templates/launchbag-debug.pt"
        permission="zope.Public"
        class="lp.services.webapp.launchbag.LaunchBagView"
        />

    <!-- Resource unnamed view, allowing Z3 preferred spelling
        /@@/launchpad-icon-small to access the images directory -->
    <browser:page
        name=""
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        class="lp.app.browser.launchpad.LaunchpadImageFolder"
        permission="zope.Public"
        />
    <browser:page
        name=""
        for="lp.services.feeds.interfaces.IFeedsApplication"
        class="lp.app.browser.launchpad.LaunchpadImageFolder"
        permission="zope.Public"
        />

    <!-- LaunchpadBrowserResponse needs to be able to find the session -->
    <adapter
        for="lp.services.webapp.servers.LaunchpadBrowserResponse"
        provides="zope.session.interfaces.ISession"
        factory="lp.services.webapp.servers.adaptResponseToSession"
        />

    <!-- LaunchpadBrowserRequest needs to be able to find the response.
    We don't just use the response attribute, as this makes our tests harder
    to write -->
    <adapter
        for="lp.services.webapp.servers.LaunchpadBrowserRequest"
        provides="lp.services.webapp.interfaces.INotificationResponse"
        factory="lp.services.webapp.servers.adaptRequestToResponse"
        />

    <adapter
        for="lp.services.webapp.servers.LaunchpadTestRequest"
        provides="lp.services.webapp.interfaces.INotificationResponse"
        factory="lp.services.webapp.servers.adaptRequestToResponse"
        />

    <adapter
        factory="lp.services.webapp.snapshot.snapshot_sql_result" />
    <!-- It also works for the legacy SQLObject interface. -->
    <adapter
        factory="lp.services.webapp.snapshot.snapshot_sql_result"
        for="storm.zope.interfaces.ISQLObjectResultSet" />

    <class class="lp.services.webapp.publisher.RenamedView">
        <allow interface="zope.publisher.interfaces.browser.IBrowserPublisher"
               attributes="__call__"/>
    </class>

    <!--These pages are used for testing BrowserNotificationMessages
        They are protected with admin privileges rather than being installed
        on the debug port because we use them in page tests and as an easy way
        to view and adjust the visual rendering of the notifications.
    -->
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+notificationtest1"
        template="templates/notification-test.pt"
        permission="launchpad.Admin"
        class="lp.services.webapp.notifications.NotificationTestView1"
        />
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+notificationtest2"
        template="templates/notification-test.pt"
        permission="launchpad.Admin"
        class="lp.services.webapp.notifications.NotificationTestView2"
        />
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+notificationtest3"
        template="templates/notification-test.pt"
        permission="launchpad.Admin"
        class="lp.services.webapp.notifications.NotificationTestView3"
        />
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+notificationtest4"
        template="templates/notification-test.pt"
        permission="launchpad.Admin"
        class="lp.services.webapp.notifications.NotificationTestView4"
        />

    <!-- Signal handlers -->
    <subscriber
        for="zope.app.appsetup.IProcessStartingEvent"
        handler="lp.services.webapp.sighup.setup_sighup"
        />
    <subscriber
        for="zope.app.appsetup.IProcessStartingEvent"
        handler="lp.services.webapp.sigusr1.setup_sigusr1"
        />
    <subscriber
        for="zope.app.appsetup.IProcessStartingEvent"
        handler="lp.services.webapp.sigusr2.setup_sigusr2"
        />
    <subscriber
        for="zope.app.appsetup.IProcessStartingEvent"
        handler="lp.services.webapp.sigdumpmem.setup_sigdumpmem"
        />

    <!-- Confirm that no main thread event handlers use the connection cache -->
    <subscriber
        for="zope.app.appsetup.IProcessStartingEvent"
        handler="lp.services.webapp.adapter.break_main_thread_db_access"
        />

    <!-- Set the default timeout function. -->
    <subscriber
        for="zope.app.appsetup.IProcessStartingEvent"
        handler="lp.services.webapp.adapter.set_launchpad_default_timeout"
        />

    <subscriber
        for="zope.app.publication.interfaces.IBeforeTraverseEvent"
        handler="lp.services.webapp.sigusr1.before_traverse"
        />

    <subscriber
        for="zope.app.publication.interfaces.IEndRequestEvent"
        handler="lp.services.webapp.sigusr1.end_request"
        />

    <class class="lp.services.webapp.publication.LoginRoot">
      <allow
        attributes="publishTraverse"
        />
    </class>

    <!-- Define the widget used by Choice fields that use huge vocabularies -->
    <view
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      for="zope.schema.interfaces.IChoice
        lp.services.webapp.vocabulary.IHugeVocabulary"
      provides="zope.app.form.interfaces.IInputWidget"
      factory="lp.app.widgets.popup.VocabularyPickerWidget"
      permission="zope.Public"
      />

    <!-- Define the widget used by PersonChoice fields. -->
    <view
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      for="lp.services.fields.PersonChoice
        lp.services.webapp.vocabulary.IHugeVocabulary"
      provides="zope.app.form.interfaces.IInputWidget"
      factory="lp.app.widgets.popup.PersonPickerWidget"
      permission="zope.Public"
      />

    <!-- Define the widget used by fields that use BranchVocabularyBase. -->
    <view
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      for="zope.schema.interfaces.IChoice
        lp.code.vocabularies.branch.BranchVocabularyBase"
      provides="zope.app.form.interfaces.IInputWidget"
      factory="lp.code.browser.widgets.branch.BranchPopupWidget"
      permission="zope.Public"
      />

    <!-- A simple view used by the page tests. -->
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+whichdb"
        permission="zope.Public"
        class="lp.services.webapp.dbpolicy.WhichDbView"
        layer="lp.layers.PageTestLayer"
        />

    <class class="lp.services.webapp.vocabulary.CountableIterator">
      <allow interface="lp.services.webapp.vocabulary.ICountableIterator" />
    </class>

    <class class="lp.services.webapp.vocabulary.BatchedCountableIterator">
      <allow interface="lp.services.webapp.vocabulary.ICountableIterator" />
    </class>

    <!-- Create a namespace to render the form of any LaunchpadFormView-->
    <view
        name="form" type="*"
        provides="zope.traversing.interfaces.ITraversable" for="*"
        factory="lp.services.webapp.namespace.FormNamespaceView"
        />

    <!-- Expose LaunchpadView methods. -->
    <class class="lp.services.webapp.publisher.LaunchpadView">
      <allow attributes="getCacheJson initialize" />
    </class>

    <!-- Create a namespace to render the model of any LaunchpadView-->
    <view
        name="model" type="*"
        provides="zope.traversing.interfaces.ITraversable" for="*"
        factory="lp.services.webapp.namespace.JsonModelNamespaceView"
        permission="zope.Public"
        />

    <class class="lp.services.webapp.namespace.JsonModelNamespaceView">
        <allow
          attributes="__call__"
          interface="zope.publisher.interfaces.browser.IBrowserPublisher" />
    </class>

    <!-- Registrations to support +haproxy status url. -->
    <browser:page
        for="lp.services.webapp.interfaces.ILaunchpadRoot"
        name="+haproxy"
        permission="zope.Public"
        class="lp.services.webapp.haproxy.HAProxyStatusView"
        />
</configure>