def urls(environ): template = os.path.join(environ['DOCUMENT_ROOT'], 'test/template') if environ['PATH_INFO'] == '/test/work': return test.work() elif environ['PATH_INFO'] == '/test/html': return test.html(environ, template) elif environ['PATH_INFO'] == '/test2': return test2.test2() else: return test.test()
# coding=utf-8 import test2 def test1(): print("---test1---") test1() test2.test2()
def test1(): return test2()
def test2(): a = test2() return str(a)
from test2 import test2 name3 = input("sdc") family3 = input("adc") obj2 = test2(name3, family3)
# coding=utf-8 from test2 import test2 from test1 import Test # def test2(): # print(Test.__test__) a = Test.__test__ print(a) print(a.split('\n')) print(id(Test)) test2()
from test2 import test2 d = {"repo": [{"name": "resque"}, {"name": "hub"}, {"name": "rip"}]} print test2(d)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Test the singleton module: . add some attributes . call function in another module that sets a singleton attribute . dump all singleton attributes . save state into a file for test3.py """ import singleton import test2 singleton.tom = 'tom' singleton.dick = 2 singleton.harry = (3.0, 'harry') test2.test2({1: 'one'}) print('singleton.test2=%s' % str(singleton.test2)) print('singleton: %s' % str(dir(singleton))) payload = singleton._payload() for (k, v) in payload.items(): print('singleton.%s=%s\t%s' % (k, str(v), type(v))) singleton._save()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Test the singleton module: . add some attributes . call function in another module that sets a singleton attribute . dump all singleton attributes . save state into a file for test3.py """ import singleton import test2 singleton.tom = 'tom' singleton.dick = 2 singleton.harry = (3.0, 'harry') test2.test2({1:'one'}) print('singleton.test2=%s' % str(singleton.test2)) print('singleton: %s' % str(dir(singleton))) payload = singleton._payload() for (k, v) in payload.items(): print('singleton.%s=%s\t%s' % (k, str(v), type(v))) singleton._save()