def dirContents(self, ino, contents=None): if not contents == None: self.data["%d" % ino] = csvPrettyPrint(contents) ans = contents else: ans = csvParse(self.data["%d" % ino]) return ans
def dirContents (self, ino, contents=None): if not contents==None: self.data["%d" % ino]= csvPrettyPrint (contents) ans= contents else: ans= csvParse (self.data["%d" % ino]) return ans
def run (self): while not self.navel._terminate: i= select ([self.socket],[],[], 5)[0] if len (i)>0: (data, client)= self.socket.recvfrom (1024) debugPrint (1, '%s shouted %s!' % (client, data)) self.socket.sendto (csvPrettyPrint ([self.navel.params ()]), client) else: self.debug (5, 'chal timeout!') self.socket.close () self.debug (1, 'finished')
def write (self, what, data=None): """ what should already be the list self.debugs the text and writes it to the file, appending a newline at the end. returns: naught """ # self.log ("[%d]--> writing" % (self._socket.fileno ())) # self.debug (1, "[%d]--> writing" % (self._socket.fileno ())) what= csvPrettyPrint (what) self.log ("[%d]--> %s" % (self._socket.fileno (), what)) size= str(len (what)).rjust (8) # add it after, so the command len is right if data: what+= data self.writeData (size+what)