work in progress: layout managememnt
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2893 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									97cea0f183
								
							
						
					
					
						commit
						49102961e5
					
				
					 2 changed files with 7 additions and 16 deletions
				
			
		|  | @ -49,17 +49,7 @@ class LayoutManager(object): | ||||||
| 
 | 
 | ||||||
|     def getLayouts(self, key, instance): |     def getLayouts(self, key, instance): | ||||||
|         region = self.regions.get(key) |         region = self.regions.get(key) | ||||||
|         if region is None: |         return instance.getLayouts(region) | ||||||
|             return [] |  | ||||||
|         result = [] |  | ||||||
|         for layout in region.layouts: |  | ||||||
|             if self.check(layout, instance): |  | ||||||
|                 result.append(layout) |  | ||||||
|         return result |  | ||||||
| 
 |  | ||||||
|     def check(self, layout, instance): |  | ||||||
|         if instance is None or instance.checkLayout(layout): |  | ||||||
|             return True |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Layout(Template): | class Layout(Template): | ||||||
|  | @ -90,6 +80,8 @@ class LayoutInstance(object): | ||||||
|     def renderer(self): |     def renderer(self): | ||||||
|         return self.template.renderer |         return self.template.renderer | ||||||
| 
 | 
 | ||||||
|     def checkLayout(self, layout): |     def getLayouts(self, region): | ||||||
|         return True |         if region is None: | ||||||
|  |             return [] | ||||||
|  |         return region.layouts | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -108,9 +108,8 @@ class ILayoutInstance(IInstance): | ||||||
| 
 | 
 | ||||||
|     renderer = Attribute(u'An object responsible for rendering the layout.') |     renderer = Attribute(u'An object responsible for rendering the layout.') | ||||||
| 
 | 
 | ||||||
|     def checkLayout(layout): |     def getLayouts(region): | ||||||
|         """ Return True if the layout given is a valid sub-layout |         """ Return a sequence of sub-layouts for the region given. | ||||||
|             for this instance. |  | ||||||
|         """ |         """ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm