add class FloatValue for transparent number formatting'
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3312 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									de820de330
								
							
						
					
					
						commit
						ee26ab3ff4
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -116,6 +116,16 @@ class BaseObject(object): | ||||||
|     collection = RelationSet |     collection = RelationSet | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | class FloatValue(float): | ||||||
|  | 
 | ||||||
|  |     def __init__(self, value, decimals=2): | ||||||
|  |         self.decimals = decimals | ||||||
|  | 
 | ||||||
|  |     def __str__(self): | ||||||
|  |         format = '%%.%if' % self.decimals | ||||||
|  |         return (format % self).replace('.', ',') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # utility functions | # utility functions | ||||||
| 
 | 
 | ||||||
| def getUidForObject(obj, intIds=None): | def getUidForObject(obj, intIds=None): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm