Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.action.thread_monitor Namespace Reference

Functions

def execute_fs
def execute_wiki

Variables

 execute = execute_fs

Function Documentation

def MoinMoin.action.thread_monitor.execute_fs (   pagename,
  request 
)

Definition at line 16 of file thread_monitor.py.

00016 
00017 def execute_fs(pagename, request):
00018     _ = request.getText
00019     # check for superuser
00020     if not request.user.isSuperUser():
00021         request.theme.add_msg(_('You are not allowed to use this action.'), "error")
00022         return Page.Page(request, pagename).send_page()
00023 
00024     if thread_monitor.hook_enabled():
00025         s = StringIO()
00026         thread_monitor.trigger_dump(s)
00027         time.sleep(5) # allow for all threads to dump to request
00028         data = s.getvalue()
00029         timestamp = time.time()
00030         dump_fname = os.path.join(request.cfg.data_dir, "tm_%d.log" % timestamp)
00031         f = file(dump_fname, "w")
00032         f.write(data)
00033         f.close()
00034     else:
00035         dump_fname = "nowhere"
00036 
00037     request.write('<html><body>A dump has been saved to %s.</body></html>' % dump_fname)

def MoinMoin.action.thread_monitor.execute_wiki (   pagename,
  request 
)

Definition at line 38 of file thread_monitor.py.

00038 
00039 def execute_wiki(pagename, request):
00040     _ = request.getText
00041     # be extra paranoid in dangerous actions
00042     actname = __name__.split('.')[-1]
00043     if not request.user.isSuperUser():
00044         request.theme.add_msg(_('You are not allowed to use this action.'), "error")
00045         return Page.Page(request, pagename).send_page()
00046 
00047     request.theme.send_title("Thread monitor")
00048     request.write('<pre>')
00049 
00050     if not thread_monitor.hook_enabled():
00051         request.write("Hook is not enabled.")
00052     else:
00053         s = StringIO()
00054         thread_monitor.trigger_dump(s)
00055         time.sleep(5) # allow for all threads to dump to request
00056         request.write(wikiutil.escape(s.getvalue()))
00057 
00058     request.write('</pre>')
00059     request.theme.send_footer(pagename)
00060     request.theme.send_closing_html()


Variable Documentation

Definition at line 61 of file thread_monitor.py.