50 lines
799 B
Python
50 lines
799 B
Python
#! /usr/bin/python
|
|
|
|
# To change this template, choose Tools | Templates
|
|
# and open the template in the editor.
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Mar 14, 2010 2:58:02 PM$"
|
|
|
|
import inspect
|
|
import os
|
|
from ct.message import write
|
|
|
|
|
|
class Plugin:
|
|
def __init__(self):
|
|
self.enabled = True
|
|
self.help = dict()
|
|
self.usage = dict()
|
|
self.minarg = 0
|
|
|
|
|
|
def open(self):
|
|
pass
|
|
|
|
|
|
def close(self):
|
|
pass
|
|
|
|
|
|
def run(self,args):
|
|
return None
|
|
|
|
|
|
def start(self,args=None):
|
|
if len(args) < self.minarg:
|
|
return
|
|
try:
|
|
return self.run(args)
|
|
|
|
# Find out information about the error
|
|
except Exception,e:
|
|
trace = inspect.trace()
|
|
frame = trace[len(trace)-1]
|
|
|
|
filename = frame[1]
|
|
lineno = str(frame[2])
|
|
|
|
filename = filename.rsplit(os.sep,1)[1]
|
|
write(filename+" ("+lineno+"): "+str(e))
|