Talkweb
A python web framework for building web apps
Installation
pip install talkweb
pip install talkback
pip install talksql
Or download releases from github and install the packages. You can get the examples app to see requests/responses.
python setup.py install #from talkback directory
python setup.py install #from talkweb directory
python setup.py install #from talksql directory
Talkweb
Templates or Objects - Talkweb likes HTML as Object tree (DOM).
from talkweb import *
roots = h2o(htmlfile)
#assuming htmlfile has <!Doctype html><html><div id="x"></div></html>
#cell is a node
x = roots[1].findcellbyid("x")
widget = h2o(widgethtmlfile)
for cell in widget:
x.addcell(cell)
html=''
for root in roots:
html += root.html()
print(html)
Like it, then you will like talkweb. Otherwise, leave you to template and its rules.
Talkback
URL mapped to functions or objects - Talkweb likes Objects called responders.
A responder framework to make a python class in separate module as a responder. It spoon feeds environment, http requests data to the responder and does some basic session management. It refers and implements some parts of some RFCs below.
- RFC 2616 - HyperText Transfer Protocol (RFC2616 4.2)
- RFC 1867 - Form based file upload
- RFC 2854 - obseletes 1867
- RFC 2965 - defines Cookie protocols over http response header protocols on RFC 2616 4.2
from wsgitalkback import uiresponder
class myresponder(uiresponder):
def respond(self):
return [bytes(str(self.environ),"utf-8")]
Always can add more features. If you like it, contribute if you see new needs.
Talksql
Get your sql work done using this util package.
ipcfg = {
'user': '',
'password': '',
'host': '1',
'db':'' }
from talksql import *
con = ipconnect(ipcfg)
sql = "select * from sometable"
#xec/rs executes the sql and returns the resultset in rs with cursor in c
rs,c=xecrs(con,sql)
#insert/update/delete
data=(,) #substituitions of %s in sql string
xec(con,sql,data)
Like it. You can use it against any database, all you need xec, xecrs and large resultsets, use cursor, skeleton code.