forked from ungleich-public/cdist
		
	test for feature instead of type
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								08762330e1
							
						
					
				
			
			
				commit
				
					
						49bdd83ea1
					
				
			
		
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -134,7 +134,11 @@ class DirectoryDict(collections.MutableMapping): | |||
|     def __setitem__(self, key, value): | ||||
|         try: | ||||
|             with open(os.path.join(self.path, key), "w") as fd: | ||||
|                 if type(value) == type([]): | ||||
|                 if (not hasattr(value, 'strip') and | ||||
|                     hasattr(value, '__getitem__') or | ||||
|                     hasattr(value, '__iter__')): | ||||
|                     # if it looks like a sequence and quacks like a sequence, | ||||
|                     # it is a sequence | ||||
|                     for v in value: | ||||
|                         fd.write(str(v) + '\n') | ||||
|                 else: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue