!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/doc/python-twisted-web/howto/   drwxr-xr-x
Free 129.75 GB of 142.11 GB (91.3%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     resource-templates.html (4.51 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Twisted Documentation: Light Weight Templating With Resource Templates

Light Weight Templating With Resource Templates

Overview

While high-level templating systems can be used with Twisted (for example, Divmod Nevow, sometimes one needs a less file-heavy system which lets one directly write HTML. While ResourceScripts are available, they have a high overhead of coding, needing some boring string arithmetic. ResourceTemplates fill the space between Nevow and ResourceScript using Quixote's PTL (Python Templating Language).

ResourceTemplates need Quixote installed. In Debian, that means using Python 2.2 and installing the quixote package (apt-get install quixote). Other operating systems require other ways to install quixote, or it can be done manually.

Configuring Twisted.Web

The easiest way to get Twisted.Web to support ResourceTemplates is to bind them to some extension using the web tap's --processor flag. Here is an example:

% twistd web --path=/var/www \
        --processor=.rtl=twisted.web.script.ResourceTemplate

The above command line binds the rtl extension to use the ResourceTemplate processor. Other ways are possible, but would require more Python coding and are outside the scope of this HOWTO.

Using ResourceTemplate

ResourceTemplates are coded in an extension of Python called the Python Templating Language. Complete documentation of the PTL is available at the quixote web site. The web server will expect the PTL source file to define a variable named resource. This should be a twisted.web.server.Resource, whose .render method be called. Usually, you would want to define render using the keyword template rather than def.

Here is a simple example for a resource template.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

from twisted.web.resource import Resource def getQuote(): return "An apple a day keeps the doctor away." class QuoteResource(Resource): template render(self, request): """\ <html> <head><title>Quotes Galore</title></head> <body><h1>Quotes</h1>""" getQuote() "</body></html>" resource = QuoteResource()
Resource Template for Quotes - listings/webquote.rtl

Index

Version: 10.1.0

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0151 ]--