/usr/share/doc/python-myghty/html/whatsitdo.html is in python-myghty 1.1-5.
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 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 | <html>
<head>
<title>
Myghty Documentation
</title>
<link href="style.css" rel="stylesheet" type="text/css"></link>
<link href="syntaxhighlight.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<link href="docs.css" rel="stylesheet" type="text/css"></link>
<div style="position:absolute;left:0px;top:0px;"><a name="top"></a> </div>
<div class="doccontainer">
<div class="docheader">
<div class="docheadertext" >Myghty Documentation</div>
<div class="">Version: 1.1 Last Updated: 09/10/06 19:32:29</div>
</div>
<A name="whatdoesitdo"></a>
<div class="topnav">
<div class="topnavcontrol">
View: <b>Paged</b> | <a href="documentation.html">One Page</a>
</div>
<div class="topnavsectionlink">
<a href="index.html">Table of Contents</a>
<div class="prevnext">
Next: <a href="installation.html">Installation</a>
</div>
</div>
<div class="topnavmain">
<div class="topnavheader">What does Myghty Do?</div>
<div class="topnavitems">
<div class="toclink">
<A style="" href="#whatdoesitdo_psp">High Performance Python Server Pages (PSP)</a>
</div>
<div class="toclinkcontainer">
</div>
<div class="toclink">
<A style="" href="#whatdoesitdo_components">Componentized Development</a>
</div>
<div class="toclinkcontainer">
</div>
<div class="toclink">
<A style="" href="#whatdoesitdo_modulecomponents">Module Components</a>
</div>
<div class="toclinkcontainer">
</div>
<div class="toclink">
<A style="" href="#whatdoesitdo_inheritance">Page Inheritance</a>
</div>
<div class="toclinkcontainer">
</div>
<div class="toclink">
<A style="" href="#whatdoesitdo_performance">Performance</a>
</div>
<div class="toclinkcontainer">
</div>
<div class="toclink">
<A style="" href="#whatdoesitdo_other">Other Features</a>
</div>
<div class="toclinkcontainer">
</div>
</div>
</div>
</div>
<div class="sectioncontent">
<div class="subsection" style="margin-left:10px;">
<div class="sectiontext">
<p>Heres a rundown of what Myghty is about, touching upon the basic features one would expect in a template system, as well as the unique features Myghty provides.
</p>
</div>
<A name="whatdoesitdo_psp"></a>
<div class="subsection" style="margin-left:20px;">
<span class="sectionheadertext">High Performance Python Server Pages (PSP)</span>
<div class="sectiontext">
<p>Myghty's primary feature is it's <b>Python Server Page (PSP)</b> system. Individual templates are generated into pure Python modules which become the method of serving the content. Myghty creates real Python modules from templates, which are regular .py files with corresponding .pyc bytecode files. These modules can also be generated in memory only, if desired.</p>
<p>Myghty templates allow full Python syntax to be embedded amongst HTML or other markup, and keeps intact the <b>full syntax and indentation scheme</b> of Python, even within very markup-interactive sections of code. Myghty also lets you organize embedded Python code in ways that minimize its intrusion upon markup. Python embedded within markup is clearly denoted via <%python> tags or the more interactive "%" syntax:</p>
<div class="code">
<pre><span class="text">
</span><span class="blocktag"><%python></span>
<span class="python_operator"> </span><span class="python_keyword">def </span><span class="python_name">somefunc</span><span class="python_enclosure">()</span><span class="python_operator">:
</span><span class="python_keyword">return </span><span class="python_name">True</span><span class="python_operator">
</span> <span class="blocktag"></%python></span><span class="text">
% if somefunc():
<p>
hello!
</p>
% # end for</span></pre></div>
<p>Read more about Myghty syntax in <a href="embedding.html#embedding" >Embedding Python in HTML</a>.</p>
<p>
Python sections can optionally have scope attributes specified, with values such as "global", "request", "init" and "cleanup", which cause the contained python code to execute at specific points in the template's execution, regardless of where they are placed in the template. This allows flexible organization of template code and a very distinct separation of Python and markup. Read more about Myghty code scope in <a href="scopedpython.html#scopedpython" >Scoped <%python> Blocks</a>.</p>
</div>
<a href="#whatdoesitdo" class="toclink">back to section top</a>
</div>
<A name="whatdoesitdo_components"></a>
<div class="subsection" style="margin-left:20px;">
<span class="sectionheadertext">Componentized Development</span>
<div class="sectiontext">
<p>Myghty allows you to organize Python code and markup into smaller sub-units of a page called <b>Components</b>. Consider a page like this:</p>
<pre>
+--------------------+
| | toolbar |
| +---------------|
| header |
|--------------------|
| | |
| left | |
| nav | content |
| | |
| | |
|--------------------|
| footer |
+--------------------+
</pre>
<p>Each subsection of this page is a likely candidate to be its own <b>component</b>. The overall template is referred to as the <b>top-level component</b>, and contains any number of <b>subcomponents</b>, which are effectively semi-autonomous units of code within a larger template file. They have their own namespaces, passed-in argument lists, buffering and caching attributes, etc. Components normally send their output to the current output stream, but can also be called as Python functions with return values, or their output content can be grabbed into a string as the return value.</p>
<p>All components are capable of calling any other component within the same template, and also of calling another template to be executed inline, or even the subcomponents contained within other templates, which are known as <b>methods</b>. With these functions, the page above can be organized into any variety of HTML/python code-snippets either within a single template file or across any combination of template and/or method library files:</p>
<pre>
components.myt
+-----------------+
| | page.myt
| | header.myt +---------------+
| +-----------+ | +---------------+ | ********** |
| | toolbar |--------------->***** |------> ********** |
| +-----------+ | | header | | |
| | +---------------+ | ** |
| +------+ | | ** page |
| | | | | ** content |
| | left | ------------------------------->** |
| | nav | | | ** |
| | | | | |
| +------+ | | +-----------+ |
| | | | footer | |
+-----------------+ | +-----------+ |
+---------------+
</pre>
<p>Components are called via the <& &> tag construct, and also support "open-tag/close-tag" behavior via the <&| &></&> syntax, known as a <b>component call with content</b>. The content within the tags is enclosed into its own Python function that is callable by the component code, allowing custom tags with full control of execution to be created.
</p>
<p>Read more about Myghty components in <a href="components.html#components" >Components</a>.</p>
</div>
<a href="#whatdoesitdo" class="toclink">back to section top</a>
</div>
<A name="whatdoesitdo_modulecomponents"></a>
<div class="subsection" style="margin-left:20px;">
<span class="sectionheadertext">Module Components</span>
<div class="sectiontext">
<p>Myghty introduces a convenient environment-agnostic way to mix regular Python modules with template code known as Module Components. The same component model that applies to templates can be applied to regular Python objects and functions, either by explicitly subclassing the ModuleComponent class in a manner similar to a Servlet, or by configuring Myghty to implicitly resolve any regular Python function, callable object, or plain object instance into a FunctionComponent (version 0.98).</p>
<p>Module Components serve primarily as the "controller" stage in a request, the initial entry point for a request that handles data loading and state changes, and then passes control onto a template for display. As they are also fully capable component objects, they can also just as easily be embedded within templates, either by themselves or wrapped around further sub-content, to allow the creation of module-based tag libraries.</p>
<p>A big advantage to using Module Components for controller code is that the application remains completely portable to any environment, including mod_python, any WSGI environment, or non-web oriented environments.</p>
<p>Read more about Myghty Module Components in <a href="modulecomponents.html#modulecomponents" >Module Components</a>.</p>
</div>
<a href="#whatdoesitdo" class="toclink">back to section top</a>
</div>
<A name="whatdoesitdo_inheritance"></a>
<div class="subsection" style="margin-left:20px;">
<span class="sectionheadertext">Page Inheritance</span>
<div class="sectiontext">
<p>Any top level component can also be <b>inherited</b> by another top level component. This means the execution of pages can be implicitly or explicitly "wrapped" by an enclosing template, which can control the execution and content embedding of its "subtemplate" at any point in its execution. In the diagram below, a content-based HTML file is enclosed by a file providing a standardized layout, which is enclosed by another file that provides session authentication code and management:
</p>
<pre>
/lib/authenticate.myt
+------------------+
|% authenticate() |
|------------------- /autohandler
| | +-----------------+
| | header | /foo/content.myt
| |-----------------| +--------+
| m.call_next() ---> | | |
| | m.call_next() ---> |content |
| | | |
| | |-----------------| +--------+
|------------------| | footer |
|% cleanup() | +-----------------+
+------------------+
</pre>
<p>The methods of a parent template are also inherited by the child and can also be overridden, allowing a sub-template to change the behavior of its parent. Layout and behavior of individual groups of templates, directories, or entire sites can be managed through a concise and centralized group of inheritable templates.
</p>
<p>Read more about Inheritance in <a href="inheritance.html#inheritance" >Inheritance</a>.</p>
</div>
<a href="#whatdoesitdo" class="toclink">back to section top</a>
</div>
<A name="whatdoesitdo_performance"></a>
<div class="subsection" style="margin-left:20px;">
<span class="sectionheadertext">Performance</span>
<div class="sectiontext">
<p>Myghty is written with fast performance and highly concurrent service in mind. A flexible cache API, supporting in-memory, file, DBM and Memcached backends allows quick re-delivery of complicated pages. Buffering can be completely disabled, for an entire site or just individual pages, to send template output to directly to the client. Expensive cache and compilation operations are process- and thread-synchronized to prevent data corruption and redundant computation. A configurable least-recently-used cache holds only the most heavily used components in memory, deferring less used ones to be loaded again from .pyc files. Filesystem checks can be disabled as well, allowing complete in-memory operation. Large chunks of plain text are distilled into large, multi-line write() statements to minimize method call overhead for large and mostly static pages.</p>
</div>
<a href="#whatdoesitdo" class="toclink">back to section top</a>
</div>
<A name="whatdoesitdo_other"></a>
<div class="subsection" style="margin-left:20px;">
<span class="sectionheadertext">Other Features</span>
<div class="sectiontext">
<ul>
<li> Session object support - can write session data into memory, plain or DBM files, or Memcached.
<li> Direct connectors for mod_python, CGI, WSGI, Python Paste, SimpleHTTPServer. As the Interpreter object is a lightweight object with no external dependencies whatsoever, any Python application or application server can invoke any series of Myghty components with just one line of code.
<li> A super-configurable ruleset driven URI resolution architecture allowing many options for resolving URI's both externally and within templates. Allows any combination of resolution directly to templates, Module Components, or any plain Python function or object instance. Special rules exist to route non-existent URI's to specific components, to cache the results of URI resolution for higher performance, and to execute conditionally based on contextual information.
<li>Cache API and implementation, can cache component output and any other data structure in memory, in plain files, DBM files, or Memcached. Includes a "busy lock" feature that allows a slow re-generation method to execute while the old data continues to be returned to other threads and processes. New cache implementations can be added fairly easily.
<li> Flexible global namespaces allow components to have any number of custom "global" variables.
<li> Special code blocks allow the construction of code that is local to the current request, or local to the current thread. A ThreadLocal object is supplied as well for safe management of thread-sensitive resources such as databases.
<li> Fine grained control of buffering - the buffering of textual output as it is delivered to the client can controlled at the application, page, or component level.
<li> Custom filtering functions can be defined for the output any component, within the source of the component via the <%filter> tag.
<li> Full featured error handling and reporting. errors can be logged to the Apache logs or standard error, caught by application code, and/or reported to the browser screen. stack traces are delivered showing original template line numbers.
</ul>
</div>
<a href="#whatdoesitdo" class="toclink">back to section top</a>
</div>
<div class="sectionnavblock">
<div class="sectionnav">
Next: <a href="installation.html">Installation</a>
</div>
</div>
</div>
</div>
</div>
<center>
</center>
</body>
</html>
|