def __str__(self): # compute maximum length of station name and cache it global _ostwidth if not _ostwidth: _ostwidth = stations.get_max_len('title') # get station name and pad string s = stations.get(self._obj.company, self) if not s or not s.title: s = '(station %5d)'%self else: s = s.title return s + ' '*(_ostwidth-len(s))
def __str__(self): # return "M:"+('%d'%long(self)).zfill(self._fieldwidth) # compute maximum length of machine name and cache it global _omwidth if not _omwidth: _omwidth = 10 if not _omwidth: _omwidth = stations.get_max_len(table='stations', field='title') # get machine name reason = databaseMismatch(int(self), self._obj) if reason != None: printDatabaseRecord(int(self), self._obj, reason) s = stations.get_machine(self._obj.company, self) if not s or not s.title: s = '' if reason == None: printDatabaseRecord(int(self), self._obj, "station/vehicle unknown") else: s = "(" + s.title + ")" s = s + ' '*(_omwidth-len(s)) return ('M:%7d'%long(self))+s