marshall individual values in grid
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3120 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									3f41ede717
								
							
						
					
					
						commit
						230f22ae08
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -187,6 +187,7 @@ class NumberFieldInstance(FieldInstance):
 | 
			
		|||
        if not value:
 | 
			
		||||
            return None
 | 
			
		||||
        try:
 | 
			
		||||
            #return int(str(value))
 | 
			
		||||
            return int(value)
 | 
			
		||||
        except (TypeError, ValueError):
 | 
			
		||||
            return float(value)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,12 +59,13 @@ class GridFieldInstance(ListFieldInstance):
 | 
			
		|||
    def marshall(self, value):
 | 
			
		||||
        if isinstance(value, basestring):
 | 
			
		||||
            return value
 | 
			
		||||
        # TODO: marshall values!
 | 
			
		||||
        v = value or []
 | 
			
		||||
        for row in v:
 | 
			
		||||
            for k, vr in row.items():
 | 
			
		||||
                if isinstance(vr, basestring):
 | 
			
		||||
                    row[k] = vr.replace('\n', '\\n').replace('"', '\\"')
 | 
			
		||||
            #for k, vr in row.items():
 | 
			
		||||
            for fi in self.columnFieldInstances:
 | 
			
		||||
                vr = fi.marshall(row[fi.name])
 | 
			
		||||
                #if isinstance(vr, basestring):
 | 
			
		||||
                row[fi.name] = vr.replace('\n', '\\n').replace('"', '\\"')
 | 
			
		||||
        empty = {}
 | 
			
		||||
        for fi in self.columnFieldInstances:
 | 
			
		||||
            default = fi.default
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue