talkback 1.4__tar.gz → 1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- talkback-1.6/PKG-INFO +96 -0
- {talkback-1.4 → talkback-1.6}/setup.py +2 -2
- {talkback-1.4 → talkback-1.6}/talkback/responder.py +15 -15
- talkback-1.6/talkback.egg-info/PKG-INFO +96 -0
- {talkback-1.4 → talkback-1.6}/talkback.egg-info/SOURCES.txt +0 -1
- talkback-1.4/PKG-INFO +0 -87
- talkback-1.4/talkback/loader.py +0 -123
- talkback-1.4/talkback.egg-info/PKG-INFO +0 -87
- {talkback-1.4 → talkback-1.6}/README.md +0 -0
- {talkback-1.4 → talkback-1.6}/setup.cfg +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/__init__.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/app.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/cookie.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/dbkeeper.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/formdata.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/fskeeper.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/parse.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/path.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/session.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback/transport.py +0 -0
- {talkback-1.4 → talkback-1.6}/talkback.egg-info/dependency_links.txt +0 -0
- {talkback-1.4 → talkback-1.6}/talkback.egg-info/not-zip-safe +0 -0
- {talkback-1.4 → talkback-1.6}/talkback.egg-info/top_level.txt +0 -0
talkback-1.6/PKG-INFO
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: talkback
|
|
3
|
+
Version: 1.6
|
|
4
|
+
Summary: A responder framework to write responders to http requests
|
|
5
|
+
Home-page: https://www.github.com/madhukumarseshadri/talkweb3
|
|
6
|
+
Author: Madhukumar Seshadri
|
|
7
|
+
Author-email: madhukumarseshadri@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Platform: any
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Web Environment
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: platform
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# talkback
|
|
30
|
+
|
|
31
|
+
Respond with your response to requests
|
|
32
|
+
|
|
33
|
+
## Use routes file to map url path to responders
|
|
34
|
+
See examples app in https://www.github.com/madhukumarseshadri/talkweb3
|
|
35
|
+
|
|
36
|
+
# Examples of GET / POST / PUT / DELETE
|
|
37
|
+
|
|
38
|
+
## Examples of managing formdata,
|
|
39
|
+
|
|
40
|
+
In the responder, self.qs is query string.
|
|
41
|
+
|
|
42
|
+
## For GET / POST, form submission html forms,
|
|
43
|
+
|
|
44
|
+
use
|
|
45
|
+
```python
|
|
46
|
+
self.processform()
|
|
47
|
+
```
|
|
48
|
+
in the responder to get the formdata [ url encoded or multipart or text/plain ]
|
|
49
|
+
|
|
50
|
+
After using processform, self.formdata.data is,
|
|
51
|
+
|
|
52
|
+
For GET,
|
|
53
|
+
self.formdata.data is a dict of field names, value pairs and field name and values are python strings and percent decoded and plus sub-ed. Get the form values as shown below,
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
57
|
+
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
58
|
+
#type - empty or b'f' with f denoting input is file
|
|
59
|
+
#fieldvalue - contents of file as bytes or field value
|
|
60
|
+
#filename - name of the file if file
|
|
61
|
+
#content_type - content_type of file if file
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For POST,
|
|
65
|
+
self.formdata.data - dict is byte field name value pairs if post is mutlipart/formdata
|
|
66
|
+
For url encoding posts, default encoding is utf8 no need to provide, provide python supported encoding or none for bytes in self.processforms(encoding=None). For utf8, values are percent decoded and plus sub-ed
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
70
|
+
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For multipart/formdata with files,
|
|
74
|
+
```python
|
|
75
|
+
type,fieldvalue,filename,content_type=self.formdata.data[b'fieldname'] or
|
|
76
|
+
type,fieldvalue,filename,content_type=self.formdata[b'file']
|
|
77
|
+
for type,fieldvalue,filename,content_type in self.formdata[b'files']:
|
|
78
|
+
#input is multiple files
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## AJAX formdata GET and POST
|
|
82
|
+
|
|
83
|
+
### GET / POST forms
|
|
84
|
+
See examples app
|
|
85
|
+
|
|
86
|
+
## For PUT,
|
|
87
|
+
use self.processinput() within a responder
|
|
88
|
+
## For DELETE
|
|
89
|
+
use self.processinput() within a responder
|
|
90
|
+
|
|
91
|
+
## OPTIONS / HEAD / CONNECT AND TRACE for http server to manage
|
|
92
|
+
|
|
93
|
+
### Examples for using session and cookies - see session.py in examples
|
|
94
|
+
|
|
95
|
+
fskeeper - keeps the sesson as file and pickles the session object to file
|
|
96
|
+
sqlkeeper - keepes the session in the database in session table
|
|
@@ -9,7 +9,7 @@ long_description=open(md_path).read()
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name = 'talkback',
|
|
12
|
-
version = '1.
|
|
12
|
+
version = '1.6',
|
|
13
13
|
license = 'MIT License',
|
|
14
14
|
url = 'https://www.github.com/madhukumarseshadri/talkweb3',
|
|
15
15
|
description = "A responder framework to write responders to http requests",
|
|
@@ -27,7 +27,7 @@ setup(
|
|
|
27
27
|
'Development Status :: 5 - Production/Stable',
|
|
28
28
|
'Environment :: Web Environment',
|
|
29
29
|
'Intended Audience :: Developers',
|
|
30
|
-
'License :: OSI Approved ::
|
|
30
|
+
'License :: OSI Approved :: MIT License',
|
|
31
31
|
'Operating System :: OS Independent',
|
|
32
32
|
'Programming Language :: Python',
|
|
33
33
|
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
|
@@ -10,6 +10,7 @@ from .formdata import *
|
|
|
10
10
|
from .loader import *
|
|
11
11
|
import re
|
|
12
12
|
import os
|
|
13
|
+
import importlib
|
|
13
14
|
|
|
14
15
|
class responders:
|
|
15
16
|
""" factory .. ask me for uriresponder class .. """
|
|
@@ -73,28 +74,27 @@ class twresponder:
|
|
|
73
74
|
def makeresponder(self,appbasedir,module,environ,session=None,cookies=None):
|
|
74
75
|
""" we make it only here so that it uniform """
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
else:
|
|
81
|
-
mybase="responder"
|
|
82
|
-
|
|
83
|
-
m=live(module,appbasedir+os.sep+'responders')
|
|
77
|
+
spec=importlib.util.spec_from_file_location("module.name", appbasedir +\
|
|
78
|
+
os.sep + "responders" + os.sep + module + ".py")
|
|
79
|
+
m=importlib.util.module_from_spec(spec)
|
|
80
|
+
|
|
84
81
|
if not m:
|
|
85
|
-
print ("responder.py:live> couldn't load module:"+
|
|
86
|
-
|
|
87
|
-
if classname not in m.__dict__:
|
|
88
|
-
print ("responder.py:live> couldn't find class in " + str(m) +'\n')
|
|
82
|
+
print ("responder.py:live> couldn't load module:"+ module + '\n')
|
|
89
83
|
|
|
90
|
-
|
|
84
|
+
spec.loader.exec_module(m)
|
|
85
|
+
|
|
86
|
+
#classname="myresponder";
|
|
87
|
+
#instancename="this";
|
|
88
|
+
mybase="uiresponder"
|
|
89
|
+
|
|
90
|
+
aninstance=m.myresponder("module.name." + mybase,(),{})
|
|
91
91
|
|
|
92
92
|
if not aninstance:
|
|
93
|
-
print (environ,"responder.py:live> couldn't instantiate :" + classname +'\n')
|
|
93
|
+
#print (environ,"responder.py:live> couldn't instantiate :" + classname +'\n')
|
|
94
|
+
print (environ,"responder.py:live> couldn't instantiate :" + mybase +'\n')
|
|
94
95
|
return
|
|
95
96
|
|
|
96
97
|
#qsaofa = http_transport.xtract_qs(qs)
|
|
97
|
-
|
|
98
98
|
self.initresponder(aninstance,appbasedir,environ,session,cookies,module)
|
|
99
99
|
return aninstance
|
|
100
100
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: talkback
|
|
3
|
+
Version: 1.6
|
|
4
|
+
Summary: A responder framework to write responders to http requests
|
|
5
|
+
Home-page: https://www.github.com/madhukumarseshadri/talkweb3
|
|
6
|
+
Author: Madhukumar Seshadri
|
|
7
|
+
Author-email: madhukumarseshadri@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Platform: any
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Web Environment
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Dynamic: author
|
|
20
|
+
Dynamic: author-email
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license
|
|
26
|
+
Dynamic: platform
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
# talkback
|
|
30
|
+
|
|
31
|
+
Respond with your response to requests
|
|
32
|
+
|
|
33
|
+
## Use routes file to map url path to responders
|
|
34
|
+
See examples app in https://www.github.com/madhukumarseshadri/talkweb3
|
|
35
|
+
|
|
36
|
+
# Examples of GET / POST / PUT / DELETE
|
|
37
|
+
|
|
38
|
+
## Examples of managing formdata,
|
|
39
|
+
|
|
40
|
+
In the responder, self.qs is query string.
|
|
41
|
+
|
|
42
|
+
## For GET / POST, form submission html forms,
|
|
43
|
+
|
|
44
|
+
use
|
|
45
|
+
```python
|
|
46
|
+
self.processform()
|
|
47
|
+
```
|
|
48
|
+
in the responder to get the formdata [ url encoded or multipart or text/plain ]
|
|
49
|
+
|
|
50
|
+
After using processform, self.formdata.data is,
|
|
51
|
+
|
|
52
|
+
For GET,
|
|
53
|
+
self.formdata.data is a dict of field names, value pairs and field name and values are python strings and percent decoded and plus sub-ed. Get the form values as shown below,
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
57
|
+
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
58
|
+
#type - empty or b'f' with f denoting input is file
|
|
59
|
+
#fieldvalue - contents of file as bytes or field value
|
|
60
|
+
#filename - name of the file if file
|
|
61
|
+
#content_type - content_type of file if file
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For POST,
|
|
65
|
+
self.formdata.data - dict is byte field name value pairs if post is mutlipart/formdata
|
|
66
|
+
For url encoding posts, default encoding is utf8 no need to provide, provide python supported encoding or none for bytes in self.processforms(encoding=None). For utf8, values are percent decoded and plus sub-ed
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
70
|
+
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For multipart/formdata with files,
|
|
74
|
+
```python
|
|
75
|
+
type,fieldvalue,filename,content_type=self.formdata.data[b'fieldname'] or
|
|
76
|
+
type,fieldvalue,filename,content_type=self.formdata[b'file']
|
|
77
|
+
for type,fieldvalue,filename,content_type in self.formdata[b'files']:
|
|
78
|
+
#input is multiple files
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## AJAX formdata GET and POST
|
|
82
|
+
|
|
83
|
+
### GET / POST forms
|
|
84
|
+
See examples app
|
|
85
|
+
|
|
86
|
+
## For PUT,
|
|
87
|
+
use self.processinput() within a responder
|
|
88
|
+
## For DELETE
|
|
89
|
+
use self.processinput() within a responder
|
|
90
|
+
|
|
91
|
+
## OPTIONS / HEAD / CONNECT AND TRACE for http server to manage
|
|
92
|
+
|
|
93
|
+
### Examples for using session and cookies - see session.py in examples
|
|
94
|
+
|
|
95
|
+
fskeeper - keeps the sesson as file and pickles the session object to file
|
|
96
|
+
sqlkeeper - keepes the session in the database in session table
|
talkback-1.4/PKG-INFO
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: talkback
|
|
3
|
-
Version: 1.4
|
|
4
|
-
Summary: A responder framework to write responders to http requests
|
|
5
|
-
Home-page: https://www.github.com/madhukumarseshadri/talkweb3
|
|
6
|
-
Author: Madhukumar Seshadri
|
|
7
|
-
Author-email: madhukumarseshadri@gmail.com
|
|
8
|
-
License: MIT License
|
|
9
|
-
Description: # talkback
|
|
10
|
-
|
|
11
|
-
Respond with your response to requests
|
|
12
|
-
|
|
13
|
-
## Use routes file to map url path to responders
|
|
14
|
-
See examples app in https://www.github.com/madhukumarseshadri/talkweb3
|
|
15
|
-
|
|
16
|
-
# Examples of GET / POST / PUT / DELETE
|
|
17
|
-
|
|
18
|
-
## Examples of managing formdata,
|
|
19
|
-
|
|
20
|
-
In the responder, self.qs is query string.
|
|
21
|
-
|
|
22
|
-
## For GET / POST, form submission html forms,
|
|
23
|
-
|
|
24
|
-
use
|
|
25
|
-
```python
|
|
26
|
-
self.processform()
|
|
27
|
-
```
|
|
28
|
-
in the responder to get the formdata [ url encoded or multipart or text/plain ]
|
|
29
|
-
|
|
30
|
-
After using processform, self.formdata.data is,
|
|
31
|
-
|
|
32
|
-
For GET,
|
|
33
|
-
self.formdata.data is a dict of field names, value pairs and field name and values are python strings and percent decoded and plus sub-ed. Get the form values as shown below,
|
|
34
|
-
|
|
35
|
-
```python
|
|
36
|
-
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
37
|
-
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
38
|
-
#type - empty or b'f' with f denoting input is file
|
|
39
|
-
#fieldvalue - contents of file as bytes or field value
|
|
40
|
-
#filename - name of the file if file
|
|
41
|
-
#content_type - content_type of file if file
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
For POST,
|
|
45
|
-
self.formdata.data - dict is byte field name value pairs if post is mutlipart/formdata
|
|
46
|
-
For url encoding posts, default encoding is utf8 no need to provide, provide python supported encoding or none for bytes in self.processforms(encoding=None). For utf8, values are percent decoded and plus sub-ed
|
|
47
|
-
|
|
48
|
-
```python
|
|
49
|
-
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
50
|
-
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
For multipart/formdata with files,
|
|
54
|
-
```python
|
|
55
|
-
type,fieldvalue,filename,content_type=self.formdata.data[b'fieldname'] or
|
|
56
|
-
type,fieldvalue,filename,content_type=self.formdata[b'file']
|
|
57
|
-
for type,fieldvalue,filename,content_type in self.formdata[b'files']:
|
|
58
|
-
#input is multiple files
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## AJAX formdata GET and POST
|
|
62
|
-
|
|
63
|
-
### GET / POST forms
|
|
64
|
-
See examples app
|
|
65
|
-
|
|
66
|
-
## For PUT,
|
|
67
|
-
use self.processinput() within a responder
|
|
68
|
-
## For DELETE
|
|
69
|
-
use self.processinput() within a responder
|
|
70
|
-
|
|
71
|
-
## OPTIONS / HEAD / CONNECT AND TRACE for http server to manage
|
|
72
|
-
|
|
73
|
-
### Examples for using session and cookies - see session.py in examples
|
|
74
|
-
|
|
75
|
-
fskeeper - keeps the sesson as file and pickles the session object to file
|
|
76
|
-
sqlkeeper - keepes the session in the database in session table
|
|
77
|
-
|
|
78
|
-
Platform: any
|
|
79
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
80
|
-
Classifier: Environment :: Web Environment
|
|
81
|
-
Classifier: Intended Audience :: Developers
|
|
82
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
83
|
-
Classifier: Operating System :: OS Independent
|
|
84
|
-
Classifier: Programming Language :: Python
|
|
85
|
-
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
86
|
-
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
87
|
-
Description-Content-Type: text/markdown
|
talkback-1.4/talkback/loader.py
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
loader.py
|
|
3
|
-
Author : Madhukumar Seshari
|
|
4
|
-
Copyright (c) Madhukumar Seshadri
|
|
5
|
-
Purpose: loads a python module
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import imp
|
|
9
|
-
import sys
|
|
10
|
-
|
|
11
|
-
class _x:
|
|
12
|
-
emptyclass=""
|
|
13
|
-
|
|
14
|
-
def hunt(s,p=None):
|
|
15
|
-
a="m"
|
|
16
|
-
if p:
|
|
17
|
-
sys.path.append(p)
|
|
18
|
-
f,fn,smt=imp.find_module(s,None)
|
|
19
|
-
if not f and fn:
|
|
20
|
-
try:
|
|
21
|
-
f = open(fn +".py","r")
|
|
22
|
-
except IOError as e:
|
|
23
|
-
#print ("tried to find as module:error",e)
|
|
24
|
-
try:
|
|
25
|
-
f = open(fn+"/__init__.py","r")
|
|
26
|
-
a="p"
|
|
27
|
-
except IOError as e:
|
|
28
|
-
#print ("trying as package: erorr ",e)
|
|
29
|
-
a=None
|
|
30
|
-
|
|
31
|
-
return (a,f,fn,smt)
|
|
32
|
-
|
|
33
|
-
def live(s,p=None):
|
|
34
|
-
""" where is s is string name of module"""
|
|
35
|
-
m=None
|
|
36
|
-
a,b,c,d=hunt(s,p)
|
|
37
|
-
if a:
|
|
38
|
-
m=imp.load_module(s,b,c,d)
|
|
39
|
-
#f=open("/tmp/a.log","w")
|
|
40
|
-
#f.write(str(m))
|
|
41
|
-
#f.close()
|
|
42
|
-
return m
|
|
43
|
-
|
|
44
|
-
def findclass(m,udef):
|
|
45
|
-
""" find a class which is name of class in string loaded in udef in a live module """
|
|
46
|
-
#print ("+ find class:",m,udef)
|
|
47
|
-
for n in m.__dict__:
|
|
48
|
-
if n in ["__builtins__","__file__","__package__"]: continue
|
|
49
|
-
o=m.__dict__[n]
|
|
50
|
-
t=type(o)
|
|
51
|
-
#print ("- iterating module:",n,o,t)
|
|
52
|
-
if t is type or t is type(_x):
|
|
53
|
-
if udef == o.__name__:
|
|
54
|
-
return o
|
|
55
|
-
|
|
56
|
-
def findmydescendents(m,base,udef=None):
|
|
57
|
-
""" find classes that are descendents of base
|
|
58
|
-
(my stands for all class needs to have __inheritances__ list loaded)
|
|
59
|
-
given
|
|
60
|
-
a live module (load using live or pointer to modules in sys.modules)
|
|
61
|
-
base is str of base class
|
|
62
|
-
udef id str of class that is descendent of base
|
|
63
|
-
"""
|
|
64
|
-
out=[]
|
|
65
|
-
#print ("+ finding class:",m,base,udef)
|
|
66
|
-
for n in m.__dict__:
|
|
67
|
-
if n in ["__builtins__","__file__","__package__"]: continue
|
|
68
|
-
o=m.__dict__[n]
|
|
69
|
-
t=type(o)
|
|
70
|
-
#print ("- iterating module:",n,o,t)
|
|
71
|
-
if t is type or t is type(_x):
|
|
72
|
-
metafound=0
|
|
73
|
-
if "__inheritances__" not in o.__dict__:
|
|
74
|
-
continue
|
|
75
|
-
for one in o.__inheritances__:
|
|
76
|
-
if base == one.__name__:
|
|
77
|
-
metafound=1
|
|
78
|
-
if metafound:
|
|
79
|
-
if udef:
|
|
80
|
-
if udef == o.__name__:
|
|
81
|
-
out.append(o)
|
|
82
|
-
else:
|
|
83
|
-
out.append(o)
|
|
84
|
-
|
|
85
|
-
return out
|
|
86
|
-
|
|
87
|
-
def instanceof(classobj,p=[]):
|
|
88
|
-
""" given a class object, let there be one of that with a name that is randomly selected """
|
|
89
|
-
syb="i"+str(1)
|
|
90
|
-
#type.__new__(meta,classname,supers,classdict)
|
|
91
|
-
syb=type.__new__(classobj,syb,(),{})
|
|
92
|
-
#classobj.__setattr__(ahash,"nameofattribute",itsvaliue)
|
|
93
|
-
return syb
|
|
94
|
-
|
|
95
|
-
"""
|
|
96
|
-
@possibilities - module inspector
|
|
97
|
-
def inspect(m):
|
|
98
|
-
#pass the module in sys.module
|
|
99
|
-
intriniscs=[int,float,str,list,dict,tuple]
|
|
100
|
-
sybtype=type(syb)
|
|
101
|
-
if sybtype in instriniscs:
|
|
102
|
-
|
|
103
|
-
elif sybtype is "classobj":
|
|
104
|
-
|
|
105
|
-
elif sybtype is "type":
|
|
106
|
-
|
|
107
|
-
elif sybtype is "function":
|
|
108
|
-
|
|
109
|
-
class a(type):
|
|
110
|
-
def __init__(self):
|
|
111
|
-
print ("x","super")
|
|
112
|
-
def am1(self):
|
|
113
|
-
print ("am1")
|
|
114
|
-
|
|
115
|
-
class d(a):
|
|
116
|
-
def __new__(cls):
|
|
117
|
-
super(d,cls).__new__()
|
|
118
|
-
|
|
119
|
-
class x:
|
|
120
|
-
__x__=""
|
|
121
|
-
|
|
122
|
-
y=type(x)("y",(x,),{}) #type(x) resolves to classobj
|
|
123
|
-
"""
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: talkback
|
|
3
|
-
Version: 1.4
|
|
4
|
-
Summary: A responder framework to write responders to http requests
|
|
5
|
-
Home-page: https://www.github.com/madhukumarseshadri/talkweb3
|
|
6
|
-
Author: Madhukumar Seshadri
|
|
7
|
-
Author-email: madhukumarseshadri@gmail.com
|
|
8
|
-
License: MIT License
|
|
9
|
-
Description: # talkback
|
|
10
|
-
|
|
11
|
-
Respond with your response to requests
|
|
12
|
-
|
|
13
|
-
## Use routes file to map url path to responders
|
|
14
|
-
See examples app in https://www.github.com/madhukumarseshadri/talkweb3
|
|
15
|
-
|
|
16
|
-
# Examples of GET / POST / PUT / DELETE
|
|
17
|
-
|
|
18
|
-
## Examples of managing formdata,
|
|
19
|
-
|
|
20
|
-
In the responder, self.qs is query string.
|
|
21
|
-
|
|
22
|
-
## For GET / POST, form submission html forms,
|
|
23
|
-
|
|
24
|
-
use
|
|
25
|
-
```python
|
|
26
|
-
self.processform()
|
|
27
|
-
```
|
|
28
|
-
in the responder to get the formdata [ url encoded or multipart or text/plain ]
|
|
29
|
-
|
|
30
|
-
After using processform, self.formdata.data is,
|
|
31
|
-
|
|
32
|
-
For GET,
|
|
33
|
-
self.formdata.data is a dict of field names, value pairs and field name and values are python strings and percent decoded and plus sub-ed. Get the form values as shown below,
|
|
34
|
-
|
|
35
|
-
```python
|
|
36
|
-
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
37
|
-
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
38
|
-
#type - empty or b'f' with f denoting input is file
|
|
39
|
-
#fieldvalue - contents of file as bytes or field value
|
|
40
|
-
#filename - name of the file if file
|
|
41
|
-
#content_type - content_type of file if file
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
For POST,
|
|
45
|
-
self.formdata.data - dict is byte field name value pairs if post is mutlipart/formdata
|
|
46
|
-
For url encoding posts, default encoding is utf8 no need to provide, provide python supported encoding or none for bytes in self.processforms(encoding=None). For utf8, values are percent decoded and plus sub-ed
|
|
47
|
-
|
|
48
|
-
```python
|
|
49
|
-
type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
|
|
50
|
-
type,fieldvalue,filename,content_type=self.formdata['fieldname']
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
For multipart/formdata with files,
|
|
54
|
-
```python
|
|
55
|
-
type,fieldvalue,filename,content_type=self.formdata.data[b'fieldname'] or
|
|
56
|
-
type,fieldvalue,filename,content_type=self.formdata[b'file']
|
|
57
|
-
for type,fieldvalue,filename,content_type in self.formdata[b'files']:
|
|
58
|
-
#input is multiple files
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## AJAX formdata GET and POST
|
|
62
|
-
|
|
63
|
-
### GET / POST forms
|
|
64
|
-
See examples app
|
|
65
|
-
|
|
66
|
-
## For PUT,
|
|
67
|
-
use self.processinput() within a responder
|
|
68
|
-
## For DELETE
|
|
69
|
-
use self.processinput() within a responder
|
|
70
|
-
|
|
71
|
-
## OPTIONS / HEAD / CONNECT AND TRACE for http server to manage
|
|
72
|
-
|
|
73
|
-
### Examples for using session and cookies - see session.py in examples
|
|
74
|
-
|
|
75
|
-
fskeeper - keeps the sesson as file and pickles the session object to file
|
|
76
|
-
sqlkeeper - keepes the session in the database in session table
|
|
77
|
-
|
|
78
|
-
Platform: any
|
|
79
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
80
|
-
Classifier: Environment :: Web Environment
|
|
81
|
-
Classifier: Intended Audience :: Developers
|
|
82
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
83
|
-
Classifier: Operating System :: OS Independent
|
|
84
|
-
Classifier: Programming Language :: Python
|
|
85
|
-
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
86
|
-
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
87
|
-
Description-Content-Type: text/markdown
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|