<html><div style='background-color:'><DIV><FONT size=2>
<P>I'm having some trouble exiting this plugin.</P>
<P>I only addes the small dialog so I can easily close the ftp for testingpurposes....</P>
<P>and it used to work fine..actually the servers still does</P>
<P>but now I added the database-support and it crashes as soon as I press my closebutton...</P>
<P>it doesn't give any exceptions, just some access violations...</P>
<P>code:</P>
<P>class CustomDialog(Dialog):</P>
<P></P>
<P>def button_1_command(self, *args):</P>
<P>top = Toplevel(self.root)</P>
<P>print "User Stopped Reator"</P>
<P>self.pol.close()</P>
<P>reactor.stop()</P>
<P></P>
<P>def setconn(self, dbppol):</P>
<P>self.pol = dbppol</P>
<P></P>
<P>class FtpDatabase(adbapi.Augmentation):</P>
<P>"""Extension for databaseaccess"""</P>
<P>def getDescription(self, user):</P>
<P>#get the users welcomedescription</P>
<P>sql = """SELECT welcomemessage FROM access WHERE name = '""" + user + """'"""</P>
<P>return self.runQuery(sql)</P>
<P></P>
<P>def setCon(self, conne):</P>
<P>self.con = conne</P>
<P></P>
<P></P>
<P>class FtpServFactory(FTPFactory):</P>
<P></P>
<P>protocol = ftpserv</P>
<P>root = "/temp"</P>
<P>anonymous = 0</P>
<P></P>
<P>def buildProtocol(self, addr):</P>
<P>print "Building Protocol"</P>
<P>p=ftpserv()</P>
<P>p.debug = 1</P>
<P>p.passw = ""</P>
<P>p.factory = self</P>
<P>return p</P>
<P></P>
<P>def setloc(self,op):</P>
<P>print "Setting Adminlib-location"</P>
<P>print op</P>
<P>try:</P>
<P>b = AdminLib.setLocation("c:\\temp\\adminlib\\")</P>
<P>val = AdminLib.getFullName("TascAdmin")</P>
<P>print "Location set!"</P>
<P>except:</P>
<P>print "Location failed to be set!"</P>
<P></P>
<P>def gotDescription(self,resultlist):</P>
<P>"""Callback for handling teh result of the query"""</P>
<P>try:</P>
<P>descr = resultlist[0][0]</P>
<P>print "Beschrijving: "</P>
<P>print descr </P>
<P>except:</P>
<P>print "no description found"</P>
<P></P>
<P></P>
<P>def initt(self,suc):</P>
<P>self.dbpool = adbapi.ConnectionPool("MySQLdb",host="10.10.0.47",db="pythonftpserv",port=3306</P>
<P>,user="root",passwd="")</P>
<P>self.db = FtpDatabase(self.dbpool)</P>
<P>self.db.getDescription("TascAdmin").addCallbacks(self.gotDescription,self.db.operationError)</P>
<P></P>
<P>root = Tk()</P>
<P>demo = CustomDialog(root, self)</P>
<P>demo.setconn(self.dbpool)</P>
<P>root.protocol('WM_DELETE_WINDOW', root.quit)</P>
<P>root.title('Dialog')</P>
<P>tksupport.install(root)</P>
<P></P>
<P>def startFactory(self):</P>
<P>print "Starting Factory"</P>
<P>self.AdLib = AdminLib</P>
<P>self.d = defer.Deferred()</P>
<P>reactor.callLater(1,self.setloc,1)</P>
<P>self.initt(3)</P>
<P>############</P>
<P></P>
<P></FONT><BR><BR>&nbsp;</P></DIV></div><br clear=all><hr>  </html>