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 | #  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 | #  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.interfaces import IFile, IImage, ITextDocument, INote | ||||||
| from loops.concept import ConceptManager, Concept | from loops.concept import ConceptManager, Concept | ||||||
| from loops.query import IQueryConcept | from loops.query import IQueryConcept | ||||||
| from loops.resource import ResourceManager | from loops.resource import ResourceManager, Resource | ||||||
| from loops.view import ViewManager, Node | from loops.view import ViewManager, Node | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -114,14 +114,15 @@ def addObject(container, class_, name, **kw): | ||||||
|     return obj |     return obj | ||||||
| 
 | 
 | ||||||
| def addAndConfigureObject(container, class_, name, **kw): | 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]) |     basicKw = dict([(k, kw[k]) for k in kw if k in basicAttributes]) | ||||||
|     obj = addObject(container, class_, name, **basicKw) |     obj = addObject(container, class_, name, **basicKw) | ||||||
|     ti = IType(obj).typeInterface |     adapted = obj | ||||||
|     if ti is not None: |     if class_ in (Concept, Resource): | ||||||
|         adapted = ti(obj) |         ti = IType(obj).typeInterface | ||||||
|     else: |         if ti is not None: | ||||||
|         adapted = obj |             adapted = ti(obj) | ||||||
|     adapterAttributes = [k for k in kw if k not in basicAttributes] |     adapterAttributes = [k for k in kw if k not in basicAttributes] | ||||||
|     for attr in adapterAttributes: |     for attr in adapterAttributes: | ||||||
|         setattr(adapted, attr, kw[attr]) |         setattr(adapted, attr, kw[attr]) | ||||||
|  |  | ||||||
|  | @ -37,6 +37,7 @@ from loops.interfaces import ILoopsObject, IIndexAttributes | ||||||
| from loops.interfaces import IDocument, IFile, ITextDocument | from loops.interfaces import IDocument, IFile, ITextDocument | ||||||
| from loops.concept import Concept | from loops.concept import Concept | ||||||
| from loops.concept import IndexAttributes as ConceptIndexAttributes | from loops.concept import IndexAttributes as ConceptIndexAttributes | ||||||
|  | from loops.query import QueryConcept | ||||||
| from loops.resource import Resource, FileAdapter, TextDocumentAdapter | from loops.resource import Resource, FileAdapter, TextDocumentAdapter | ||||||
| from loops.resource import IndexAttributes as ResourceIndexAttributes | from loops.resource import IndexAttributes as ResourceIndexAttributes | ||||||
| from loops.schema import ResourceSchemaFactory, FileSchemaFactory, NoteSchemaFactory | from loops.schema import ResourceSchemaFactory, FileSchemaFactory, NoteSchemaFactory | ||||||
|  | @ -78,6 +79,7 @@ class TestSite(object): | ||||||
|         component.provideAdapter(ConceptType) |         component.provideAdapter(ConceptType) | ||||||
|         component.provideAdapter(ResourceType, (IDocument,)) |         component.provideAdapter(ResourceType, (IDocument,)) | ||||||
|         component.provideAdapter(TypeConcept) |         component.provideAdapter(TypeConcept) | ||||||
|  |         component.provideAdapter(QueryConcept) | ||||||
|         component.provideAdapter(FileAdapter, provides=IFile) |         component.provideAdapter(FileAdapter, provides=IFile) | ||||||
|         component.provideAdapter(TextDocumentAdapter, provides=ITextDocument) |         component.provideAdapter(TextDocumentAdapter, provides=ITextDocument) | ||||||
|         component.provideAdapter(NodeAdapter) |         component.provideAdapter(NodeAdapter) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm