source: WAeUP_SRP/branches/uli/skins/waeup_student/getLogData.py @ 17397

Last change on this file since 17397 was 1570, checked in by uli, 18 years ago

Added log file viewer.

File size: 801 bytes
Line 
1## Script (Python) "getLogData"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10"""
11return logfile entries
12"""
13
14wtool = context.waeup_tool
15
16# Default values...
17filename = "event.log"
18numlines = 30
19
20# Validate posted vars...
21request = container.REQUEST
22if 'filename' in request.keys():
23    if request['filename'] in ['event.log','Z2.log']:
24        filename = request['filename']
25
26if 'numlines' in request.keys():
27    try:
28        reqlines = int(request['numlines'])
29        if reqlines > 0 and reqlines < 1000:
30            numlines = reqlines
31    except:
32        pass
33
34return { 'filename' : filename,
35         'numlines' : numlines,
36         'lines' : wtool.getLogfileLines(filename, numlines)
37       }
Note: See TracBrowser for help on using the repository browser.