This file is indexed.

/usr/share/doc/python-simpletal/html/api-simpletales.html is in python-simpletal 4.1-7.

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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>SimpleTAL API: simpleTALES Module.</title>
	<link href="../style/site.css" type="text/css" rel="stylesheet">
</head>
<body>
<h1>SimpleTAL API: simpleTALES Module.</h1>
  <p id="subject">Documentation on how to use the simpleTALES Module.</p>
  <div><h2>simpleTALES</h2>
<p>The only external class in this module is the Context class.</p>
<h3>Context ([options] [,allowPythonPath])</h3>
<p>Creates a new Context object, used by SimpleTAL when expanding a template.&nbsp; The options variable, if passed, will be made available as a global variable under the name "options" as per the TALES specification.</p>
<p>By default Python TAL paths (e.g. 'python: 1 + 2') are not allowed.&nbsp; If you require them, and you completely trust the authors of the templates, they can be enabled by passing in allowPythonPath=1.</p>
<h4>Context.addGlobal (name, value)</h4>
<p>Adds the value to the context under name.&nbsp; Value can either be a fundamental python data type or a callable object.&nbsp; For example, take the code:</p>
<pre>
<code>
class Test:
	def __init__ (self, val):
		self.val = val
		
	def getResult (self):
		return str (self.val + 4)
		
test = Test (10)

context = SimpleTALES.Context()
context.addGlobal ("number14", test.getResult)
context.addGlobal ("data", {"one": {"blue": ("Cat", "Dog", "Mouse"), "pink": ["One"]}})
</code>
</pre>
<p>The affect of this context is shown for several different TALES expressions:</p>
<pre>
<code>
&lt;b tal:define="test1 nocall:number14"&gt;&lt;/b&gt;</code>
</pre>
<p>The method 'getResult' is bound to the local variable test1.</p>
<pre>
<code>
&lt;b tal:define="test2 number14"&gt;&lt;/b&gt;
</code>
</pre>
<p>The local variable test2 is assigned the value "14"</p>
<pre>
<code>
&lt;b tal:repeat="pets data/one/blue"&gt;&lt;i tal:replace="pets"&gt;&lt;/i&gt;&lt;/b&gt;
</code>
</pre>
<p>Prints out &lt;b&gt;CatDogMouse&lt;/b&gt;</p>
<p>All strings placed into the context, and all strings returned by callable objects should be unicode strings.&nbsp; This allows the rendering of the template into different character sets&nbsp; without requiring any code changes.</p>
<h3><a name="PathFunctionVariable">PathFunctionVariable (callableObject)</a></h3>
<p>This class wraps a callable object (e.g. function) so that it can receive part of a TAL path as it's argument.&nbsp; To use this simply create a new instance of the PathFunctionVariable and then place this into the Context (see above).&nbsp; The path passed to the function is that part of the path not already used.&nbsp; For example if the function "helloFunc" is placed in the Context the path "helloFunc/an/example" results in the string "an/example" being passed to the function.</p>
<h3>CachedFuncResult (callableObject)</h3>
<p>This class wraps a callable object (e.g. function) so that the callable is only called once.&nbsp; In normal SimpleTAL operation any function placed into a Context will be called multiple times during template expansion.&nbsp; To ensure that it is only called once simply wrap in the CachedFuncResult object first.</p>
<h4>clearCache ()</h4>
<p>Clears the cache.&nbsp; Use this to clear the cache between multiple template expansions if the callable should be executed once per template expansion.</p>
<p><a href="api.html">Back to SimpleTAL API</a></p>
</div>
	  
  <p id="version">PubTal Version </p>
  <div id="footer">
  <p>File: api-simpletales.txt</p>
  <p>Last modified: Wed, 28 Apr 2004 23:08:24 EDT</p>
  <p>Copyright 2005 Colin Stewart</p>
  <p title="PubTal is a template driven web site publisher.">Made with <a href="http://www.owlfish.com/software/PubTal/">PubTal</a> 3.1.3</p>
  </div>
</body>