This file is indexed.

/usr/share/pyshared/z3c.macro-1.4.2.egg-info/PKG-INFO is in python-z3c.macro 1.4.2-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
Metadata-Version: 1.1
Name: z3c.macro
Version: 1.4.2
Summary: Simpler definition of ZPT macros.
Home-page: http://pypi.python.org/pypi/z3c.macro
Author: Roger Ineichen and the Zope Community
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: This package provides an adapter and a TALES expression for a more explicit and
        more flexible macro handling using the adapter registry for macros.
        
        
        Detailed Documentation
        ======================
        
        
        =====
        Macro
        =====
        
        This package provides a adapter and a TALES expression for a expliciter and
        flexibler macro handling using the adapter registry for macros.
        
        We start with creating a content object that is used as a view context later:
        
          >>> import zope.interface
          >>> import zope.component
          >>> from zope.publisher.interfaces.browser import IBrowserView
          >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
          >>> class Content(object):
          ...     zope.interface.implements(zope.interface.Interface)
        
          >>> content = Content()
        
        We also create a temp dir for sample templates which we define later for
        testing:
        
          >>> import os, tempfile
          >>> temp_dir = tempfile.mkdtemp()
        
        
        Macro Template
        --------------
        
        We define a macro template as a adapter providing IMacroTemplate:
        
          >>> path = os.path.join(temp_dir, 'navigation.pt')
          >>> open(path, 'w').write('''
          ... <metal:block define-macro="navigation">
          ...   <div tal:content="title">---</div>
          ... </metal:block>
          ... ''')
        
        Let's define the macro factory
        
          >>> from z3c.macro import interfaces
          >>> from z3c.macro import zcml
          >>> navigationMacro = zcml.MacroFactory(path, 'navigation', 'text/html')
        
        and register them as adapter:
        
          >>> zope.component.provideAdapter(
          ...     navigationMacro,
          ...     (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
          ...     interfaces.IMacroTemplate,
          ...     name='navigation')
        
        
        The TALES ``macro`` Expression
        ------------------------------
        
        The ``macro`` expression will look up the name of the macro, call a adapter
        providing IMacroTemplate and uses them or fills a slot if defined in the
        ``macro`` expression.
        
        Let's create a page template using the ``navigation`` macros:
        
          >>> path = os.path.join(temp_dir, 'first.pt')
          >>> open(path, 'w').write('''
          ... <html>
          ...   <body>
          ...     <h1>First Page</h1>
          ...     <div class="navi">
          ...       <tal:block define="title string:My Navigation">
          ...         <metal:block use-macro="macro:navigation" />
          ...       </tal:block>
          ...     </div>
          ...     <div class="content">
          ...       Content here
          ...     </div>
          ...   </body>
          ... </html>
          ... ''')
        
        As you can see, we used the ``macro`` expression to simply look up a macro
        called navigation whihc get inserted and replaces the HTML content at this
        place.
        
        Let's now create a view using this page template:
        
          >>> from zope.publisher.browser import BrowserView
          >>> class simple(BrowserView):
          ...     def __getitem__(self, name):
          ...         return self.index.macros[name]
          ...
          ...     def __call__(self, **kwargs):
          ...         return self.index(**kwargs)
        
          >>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile  
          >>> def SimpleViewClass(path, name=u''):
          ...     return type(
          ...         "SimpleViewClass", (simple,),
          ...         {'index': ViewPageTemplateFile(path), '__name__': name})
          
          >>> FirstPage = SimpleViewClass(path, name='first.html')
        
          >>> zope.component.provideAdapter(
          ...     FirstPage,
          ...     (zope.interface.Interface, IDefaultBrowserLayer),
          ...     zope.interface.Interface,
          ...     name='first.html')
        
        Finally we look up the view and render it:
        
          >>> from zope.publisher.browser import TestRequest
          >>> request = TestRequest()
        
          >>> view = zope.component.getMultiAdapter((content, request),
          ...                                       name='first.html')
          >>> print view().strip()
          <html>
            <body>
              <h1>First Page</h1>
              <div class="navi">
                <div>My Navigation</div>
              </div>
              <div class="content">
                Content here
              </div>
            </body>
          </html>
        
        
        Slot
        ----
        
        We can also define a macro slot and fill it with given content:
        
          >>> path = os.path.join(temp_dir, 'addons.pt')
          >>> open(path, 'w').write('''
          ... <metal:block define-macro="addons">
          ...   Content before header
          ...   <metal:block define-slot="header">
          ...     <div>My Header</div>
          ...   </metal:block>
          ...   Content after header
          ... </metal:block>
          ... ''')
        
        Let's define the macro factory
        
          >>> addonsMacro = zcml.MacroFactory(path, 'addons', 'text/html')
        
        and register them as adapter:
        
          >>> zope.component.provideAdapter(
          ...     addonsMacro,
          ...     (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
          ...     interfaces.IMacroTemplate,
          ...     name='addons')
        
        Let's create a page template using the ``addons`` macros:
        
          >>> path = os.path.join(temp_dir, 'second.pt')
          >>> open(path, 'w').write('''
          ... <html>
          ...   <body>
          ...     <h1>Second Page</h1>
          ...     <div class="header">
          ...       <metal:block use-macro="macro:addons">
          ...         This line get ignored
          ...         <metal:block fill-slot="header">
          ...           Header comes from here
          ...         </metal:block>
          ...         This line get ignored
          ...       </metal:block>
          ...     </div>
          ...   </body>
          ... </html>
          ... ''')
        
        Let's now create a view using this page template:
        
          >>> SecondPage = SimpleViewClass(path, name='second.html')
        
          >>> zope.component.provideAdapter(
          ...     SecondPage,
          ...     (zope.interface.Interface, IDefaultBrowserLayer),
          ...     zope.interface.Interface,
          ...     name='second.html')
        
        Finally we look up the view and render it:
        
          >>> view = zope.component.getMultiAdapter((content, request),
          ...                                       name='second.html')
          >>> print view().strip()
          <html>
            <body>
              <h1>Second Page</h1>
              <div class="header">
          <BLANKLINE>
            Content before header
          <BLANKLINE>
                    Header comes from here
          <BLANKLINE>
            Content after header
              </div>
            </body>
          </html>
        
        
        Cleanup
        -------
        
          >>> import shutil
          >>> shutil.rmtree(temp_dir)
        
        
        
        ===============
        macro directive
        ===============
        
        A macro directive can be used for register macros. Take a look at the
        README.txt which explains the macro TALES expression.
        
          >>> import sys
          >>> from zope.configuration import xmlconfig
          >>> import z3c.template
          >>> context = xmlconfig.file('meta.zcml', z3c.macro)
        
        First define a template which defines a macro:
        
          >>> import os, tempfile
          >>> temp_dir = tempfile.mkdtemp()
          >>> file = os.path.join(temp_dir, 'file.pt')
          >>> open(file, 'w').write('''
          ... <html>
          ...   <head>
          ...     <metal:block define-macro="title">
          ...        <title>Pagelet skin</title>
          ...     </metal:block>
          ...   </head>
          ...   <body>
          ...     <div>content</div>
          ...   </body>
          ... </html>
          ... ''')
        
        and register the macro provider within the ``z3c:macroProvider`` directive:
        
          >>> context = xmlconfig.string("""
          ... <configure
          ...     xmlns:z3c="http://namespaces.zope.org/z3c">
          ...   <z3c:macro
          ...       template="%s"
          ...       name="title"
          ...       />
          ... </configure>
          ... """ % file, context=context)
        
        We need a content object...
        
          >>> import zope.interface
          >>> class Content(object):
          ...     zope.interface.implements(zope.interface.Interface)
          >>> content = Content()
        
        and we need a view...
        
          >>> import zope.interface
          >>> import zope.component
          >>> from zope.publisher.browser import BrowserPage
          >>> class View(BrowserPage):
          ...     def __init__(self, context, request):
          ...         self.context = context
          ...         self.request = request
        
        and we need a request:
          >>> from zope.publisher.browser import TestRequest
          >>> request = TestRequest()
        
        Check if we get the macro template:
        
          >>> from z3c.macro import interfaces
          >>> view = View(content, request)
        
          >>> macro = zope.component.queryMultiAdapter((content, view, request),
          ...     interface=interfaces.IMacroTemplate, name='title')
        
          >>> macro is not None
          True
        
          >>> import os, tempfile
          >>> temp_dir = tempfile.mkdtemp()
          >>> file = os.path.join(temp_dir, 'test.pt')
          >>> open(file, 'w').write('''
          ... <html>
          ...   <body>
          ...     <metal:macro use-macro="options/macro" />
          ...   </body>
          ... </html>
          ... ''')
        
          >>> from zope.browserpage.viewpagetemplatefile import BoundPageTemplate
          >>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
          >>> template = ViewPageTemplateFile(file)
          >>> print BoundPageTemplate(template, view)(macro=macro)
          <html>
            <body>
              <title>Pagelet skin</title>
            </body>
          </html>
        
        
        =======
        CHANGES
        =======
        
        1.4.2 (2012-02-15)
        ------------------
        
        - Remove hooks to use ViewPageTemplateFile from z3c.pt because this breaks when
          z3c.pt is available, but z3c.ptcompat is not included. As recommended by notes
          in 1.4.0 release.
        
        
        1.4.1 (2011-11-15)
        ------------------
        
        - bugfix, missing comma in setup install_requires list 
        
        
        1.4.0 (2011-10-29)
        ------------------
        
        - Moved z3c.pt include to extras_require chameleon. This makes the package
          independent from chameleon and friends and allows to include this
          dependencies in your own project.
        
        - Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
          z3c.ptcompat packages adjusted to work with chameleon 2.0.
          
          See the notes from the z3c.ptcompat package:
        
          Update z3c.ptcompat implementation to use component-based template engine
          configuration, plugging directly into the Zope Toolkit framework.
        
          The z3c.ptcompat package no longer provides template classes, or ZCML
          directives; you should import directly from the ZTK codebase.
        
          Note that the ``PREFER_Z3C_PT`` environment option has been
          rendered obsolete; instead, this is now managed via component
          configuration.
          
          Also note that the chameleon CHAMELEON_CACHE environment value changed from
          True/False to a path. Skip this property if you don't like to use a cache.
          None or False defined in buildout environment section doesn't work. At least
          with chameleon <= 2.5.4
          
          Attention: You need to include the configure.zcml file from z3c.ptcompat
          for enable the z3c.pt template engine. The configure.zcml will plugin the 
          template engine. Also remove any custom built hooks which will import
          z3c.ptcompat in your tests or other places.
        
        
        1.3.0 (2010-07-05)
        ------------------
        
        - Tests now require ``zope.browserpage >= 3.12`` instead of
          ``zope.app.pagetemplate`` as the expression type registration has
          been moved there recently.
        
        - No longer using deprecated ``zope.testing.doctestunit`` but built-in
          ``doctest`` instead.
        
        
        1.2.1 (2009-03-07)
        ------------------
        
        - Presence of ``z3c.pt`` is not sufficient to register macro-utility,
          ``chameleon.zpt`` is required otherwise the factory for the utility
          is not defined.
        
        
        1.2.0 (2009-03-07)
        ------------------
        
        - Allow use of ``z3c.pt`` using ``z3c.ptcompat`` compatibility layer.
        
        - Change package's mailing list address to zope-dev at zope.org.
        
        
        1.1.0 (2007-11-01)
        ------------------
        
        - Update package info data.
        
        - Add z3c namespace package declaration.
        
        
        1.0.0 (2007-09-30)
        ------------------
        
        - Initial release.
        
Keywords: zope3 macro pagetemplate zpt
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3