Changeset 1572 for WAeUP_SRP/trunk
- Timestamp:
- 17 Mar 2007, 15:58:54 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTool.py
r1571 r1572 478 478 ###) 479 479 480 security.declareProtected(ModifyPortalContent,'getLogfileLines') ###( 481 def getLogfileLines(self,filename="event.log",numlines=20): 482 """Get last NUMLINES lines of logfile FILENAME. 483 484 Return last lines' of a file in the instances logfile directory as 485 a list. The number of returned lines equals `numlines' or less. If 486 less than `numlines' lines are available, the whole file ist 487 returned. If the file can not be opened or some other error 488 occurs, empty list is returend. 489 """ 490 result = [] 491 lines_hit = 0 492 493 # We only handle files in instances' log directory... 494 logpath = os.path.join(i_home, "log") 495 filename = str(os.path.abspath( os.path.join( logpath, filename ))) 496 if not filename.startswith( logpath ): 497 # Attempt to access file outside log-dir... 498 return [] 499 500 try: 501 fd = file( filename, "rb" ) 502 except IOError: 503 return [] 504 if not fd: 505 return [] 506 507 if os.linesep == None: 508 linesep = '\n' 509 else: 510 linesep = os.linesep 511 512 # Try to find 'numlines' times a lineseparator, searching from end 513 # and moving to the beginning of file... 514 fd.seek( 0, 2) # Move to end of file... 515 while lines_hit < numlines: 516 if fd.read(1) == linesep[-1]: # This moves filedescriptor 517 # one step forward... 518 lines_hit += 1 519 try: 520 fd.seek( -2, 1) # Go two bytes back from current pos... 521 except IOError: 522 # We cannot go back two bytes. Maybe the file is too small... 523 break 524 fd.seek(2,1) 525 526 # Read all lines from current position... 527 result = fd.readlines() 528 # Remove line endings... 529 result = [x.strip() for x in result] 530 fd.close() 531 return result 532 ###) 480 533 481 534 InitializeClass(WAeUPTool) -
WAeUP_SRP/trunk/skins/waeup_student/search_students_form.pt
r1568 r1572 27 27 <nobr><a href="statistics_reg_view">Registration Statistics</a> 28 28 </nobr> 29 <nobr><a href="list_students">Cleared Student Export</a> 30 </nobr> 29 31 <span tal:condition="is_so"> 30 <nobr><a href=" list_students">Cleared Student Export</a>32 <nobr><a href="view_logs">View Log Files</a> 31 33 </nobr> 32 <nobr><a href=" paid_transfer_list">Transfer Student Export</a></nobr>33 34 <nobr><a href=" add_student">Add Student Record</a></nobr>34 <nobr><a href="add_student">Add Student Record</a> 35 </nobr> 36 <nobr><a href="paid_transfer_list">Export Transfer Students</a></nobr> 35 37 </span> 36 38 </strong> 39 40 37 41 <h3> Search Student Section</h3><br /> 38 42 You are logged in as member <span tal:replace="info/member|nothing" /> … … 42 46 </span> 43 47 <span tal:condition="info/departments|nothing" tal:omit-tag=""> 44 and <span tal:repeat="department info/departments|nothing" tal:content="department"/></span> 45 <span tal:condition="info/certificate_level|nothing" tal:omit-tag=""> 46 who is CourseAdviser for 47 <span tal:repeat="cl info/certificate_level" tal:content="cl" /> 48 </span>. 48 and <span tal:repeat="department info/departments|nothing" tal:content="department"/></span>. 49 49 <br /><br /> 50 50 <span tal:replace="structure rendered" /> -
WAeUP_SRP/trunk/skins/waeup_student/students_index.py
r1557 r1572 25 25 if "ClearanceOfficers" in member.getGroups() or\ 26 26 "CourseAdvisers" in member.getGroups(): 27 return redirect("%s/ search_students" % context.portal_url())27 return redirect("%s/campus/search_students" % context.portal_url()) 28 28 if context.isSectionOfficer(): 29 return redirect("%s/ search_students" % context.portal_url())29 return redirect("%s/campus/search_students" % context.portal_url()) 30 30 if context.isStudent(): 31 31 id = str(member)
Note: See TracChangeset for help on using the changeset viewer.