setup improvements to facilitate setting up entire loops sites
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2304 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									31a6e91114
								
							
						
					
					
						commit
						0cf020c289
					
				
					 3 changed files with 11 additions and 8 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| # | ||||
| #  Copyright (c) 2006 Helmut Merz helmutm@cy55.de | ||||
| #  Copyright (c) 2008 Helmut Merz helmutm@cy55.de | ||||
| # | ||||
| #  This program is free software; you can redistribute it and/or modify | ||||
| #  it under the terms of the GNU General Public License as published by | ||||
|  |  | |||
							
								
								
									
										15
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								setup.py
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ from loops.interfaces import ILoops, ITypeConcept | |||
| from loops.interfaces import IFile, IImage, ITextDocument, INote | ||||
| from loops.concept import ConceptManager, Concept | ||||
| from loops.query import IQueryConcept | ||||
| from loops.resource import ResourceManager | ||||
| from loops.resource import ResourceManager, Resource | ||||
| from loops.view import ViewManager, Node | ||||
| 
 | ||||
| 
 | ||||
|  | @ -114,14 +114,15 @@ def addObject(container, class_, name, **kw): | |||
|     return obj | ||||
| 
 | ||||
| def addAndConfigureObject(container, class_, name, **kw): | ||||
|     basicAttributes = ('title', 'description', 'conceptType', 'resourceType') | ||||
|     basicAttributes = ('title', 'description', 'conceptType', 'resourceType', | ||||
|                        'nodeType', 'body') | ||||
|     basicKw = dict([(k, kw[k]) for k in kw if k in basicAttributes]) | ||||
|     obj = addObject(container, class_, name, **basicKw) | ||||
|     ti = IType(obj).typeInterface | ||||
|     if ti is not None: | ||||
|         adapted = ti(obj) | ||||
|     else: | ||||
|         adapted = obj | ||||
|     adapted = obj | ||||
|     if class_ in (Concept, Resource): | ||||
|         ti = IType(obj).typeInterface | ||||
|         if ti is not None: | ||||
|             adapted = ti(obj) | ||||
|     adapterAttributes = [k for k in kw if k not in basicAttributes] | ||||
|     for attr in adapterAttributes: | ||||
|         setattr(adapted, attr, kw[attr]) | ||||
|  |  | |||
|  | @ -37,6 +37,7 @@ from loops.interfaces import ILoopsObject, IIndexAttributes | |||
| from loops.interfaces import IDocument, IFile, ITextDocument | ||||
| from loops.concept import Concept | ||||
| from loops.concept import IndexAttributes as ConceptIndexAttributes | ||||
| from loops.query import QueryConcept | ||||
| from loops.resource import Resource, FileAdapter, TextDocumentAdapter | ||||
| from loops.resource import IndexAttributes as ResourceIndexAttributes | ||||
| from loops.schema import ResourceSchemaFactory, FileSchemaFactory, NoteSchemaFactory | ||||
|  | @ -78,6 +79,7 @@ class TestSite(object): | |||
|         component.provideAdapter(ConceptType) | ||||
|         component.provideAdapter(ResourceType, (IDocument,)) | ||||
|         component.provideAdapter(TypeConcept) | ||||
|         component.provideAdapter(QueryConcept) | ||||
|         component.provideAdapter(FileAdapter, provides=IFile) | ||||
|         component.provideAdapter(TextDocumentAdapter, provides=ITextDocument) | ||||
|         component.provideAdapter(NodeAdapter) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm