-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb_app.py
More file actions
79 lines (52 loc) · 1.88 KB
/
Copy pathweb_app.py
File metadata and controls
79 lines (52 loc) · 1.88 KB
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
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#
__all__ = ['WebAppException', 'WebApp']
import types, time
from pyasm.common import *
from pyasm.search import SearchType, Sql
from widget import *
from html_wdg import *
from web_container import *
class WebAppException(Exception):
pass
class WebApp(Base):
"""Defines a pipeline for displaying a web application"""
def __init__(my):
pass
def get_display(my, widget):
"""run through the full web app pipeline"""
if widget == None:
raise WebAppException("No top level widget defined")
# add to the access log
# FIXME: this does not get committed if there is an exception. The
# transaction will back out.
access_log_flag = False
access_log = None
if access_log_flag:
access_log = SearchType.create("sthpw/access_log")
access_log.set_value("url", "www.yahoo.com")
access_log.set_value("start_time", Sql.get_timestamp_now(), quoted=False)
access_log.commit()
start = time.time()
# do a security check on the widget
# DEPRECATED
widget.check_security()
# draw all of the widgets
widget = widget.get_display()
if widget:
Widget.get_display(widget)
if access_log_flag:
access_log.set_value("end_time", Sql.get_timestamp_now(), quoted=False)
duration = time.time() - start
duration = float(int(duration * 1000)) / 1000
access_log.set_value("duration", str(duration) )
access_log.commit()