Return-Path: Mailing-List: contact gump-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list gump@jakarta.apache.org Received: (qmail 17324 invoked by uid 500); 17 Oct 2003 18:33:03 -0000 Received: (qmail 17320 invoked from network); 17 Oct 2003 18:33:03 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 17 Oct 2003 18:33:03 -0000 Received: (qmail 50443 invoked by uid 1728); 17 Oct 2003 18:33:12 -0000 Date: 17 Oct 2003 18:33:12 -0000 Message-ID: <20031017183312.50442.qmail@minotaur.apache.org> From: ajack@apache.org To: jakarta-gump-cvs@apache.org Subject: cvs commit: jakarta-gump/python/gump build.py xmlutils.py utils.py X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ajack 2003/10/17 11:33:12 Modified: python/gump build.py xmlutils.py utils.py Log: getStringFromUnicode default to ASCII, falls back to Latin-1, or gives _ Revision Changes Path 1.27 +7 -4 jakarta-gump/python/gump/build.py Index: build.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/build.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- build.py 16 Oct 2003 17:37:39 -0000 1.26 +++ build.py 17 Oct 2003 18:33:12 -0000 1.27 @@ -232,12 +232,15 @@ # outputs, to see what is there. # dirs=[] + dircnt=0 for i in range(0,len(project.jar)): jar=os.path.normpath(project.jar[i].path) if jar: dir=os.path.dirname(jar) if not dir in dirs and os.path.exists(dir): - listDirectoryAsWork(pctxt,dir,'list_'+project.name+'_'+os.path.basename(dir)) + dircnt += 1 + listDirectoryAsWork(pctxt,dir,\ + 'list_'+project.name+'_'+str(dircnt)+'_'+os.path.basename(dir)) dirs.append(dir) else: pctxt.addWarning("No such directory (where output is expect) : " + dir) 1.5 +0 -1 jakarta-gump/python/gump/xmlutils.py Index: xmlutils.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/xmlutils.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- xmlutils.py 26 Sep 2003 20:35:21 -0000 1.4 +++ xmlutils.py 17 Oct 2003 18:33:12 -0000 1.5 @@ -193,7 +193,6 @@ self.element=self.cls(attrs) return self.element - class Named(GumpXMLObject): """Named elements (e.g., project,module,repository). 1.6 +22 -0 jakarta-gump/python/gump/utils.py Index: utils.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/utils.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- utils.py 17 Oct 2003 03:48:14 -0000 1.5 +++ utils.py 17 Oct 2003 18:33:12 -0000 1.6 @@ -195,6 +195,26 @@ #:TODO: Don't show hours if 0, show mins/secs words return ('%02d:%02d:%02d' % elapsed) + +# +# Get into ASCII, but make an attempt at coping with +# non-ASCII +# +def getStringFromUnicode(u): + try: + s = str(u) + except UnicodeException: + s = '' + for uc in u: + try: + sc = uc.encode('latin-1') + except UnicodeException: + sc = '_' + # Add character by character + s += sc + + return s + if __name__=='__main__': # init logging @@ -208,4 +228,6 @@ print "secsToElapsedTime(1340) : " + str(secsToElapsedTime(1340)) print "secsToString(1340) : " + secsToString(1340) print "elapsedTimeToString(secsToElapsedTime(1340)) : " + elapsedTimeToString(secsToElapsedTime(1340)) + + print "str = " + getStringFromUnicode("Ceki G�lc�")