provide raw rendering of target object via render.html
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3244 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									c80096244c
								
							
						
					
					
						commit
						cb975d38c7
					
				
					 4 changed files with 19 additions and 17 deletions
				
			
		|  | @ -644,21 +644,16 @@ | ||||||
| 
 | 
 | ||||||
|   <!-- render file or image assigned to a node as target --> |   <!-- render file or image assigned to a node as target --> | ||||||
| 
 | 
 | ||||||
|   <page |   <pages for="loops.interfaces.INode" | ||||||
|       name="view" |          class=".node.NodeView" | ||||||
|       for="loops.interfaces.INode" |          permission="zope.View"> | ||||||
|       class=".node.NodeView" |     <page name="view" | ||||||
|       attribute="targetDefaultView" |           attribute="targetDefaultView" /> | ||||||
|       permission="zope.View" |     <page name="download.html" | ||||||
|       /> |           attribute="targetDownload" /> | ||||||
| 
 |     <page name="render.html" | ||||||
|   <page |           attribute="targetRender" /> | ||||||
|       name="download.html" |   </pages> | ||||||
|       for="loops.interfaces.INode" |  | ||||||
|       class=".node.NodeView" |  | ||||||
|       attribute="targetDownload" |  | ||||||
|       permission="zope.View" |  | ||||||
|       /> |  | ||||||
| 
 | 
 | ||||||
|   <!-- vocabulary, traversing, and other stuff --> |   <!-- vocabulary, traversing, and other stuff --> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -364,6 +364,9 @@ class NodeView(BaseView): | ||||||
|     def targetDownload(self): |     def targetDownload(self): | ||||||
|         return self.targetView('download.html', 'download') |         return self.targetView('download.html', 'download') | ||||||
| 
 | 
 | ||||||
|  |     def targetRender(self): | ||||||
|  |         return self.targetView('download.html', 'show') | ||||||
|  | 
 | ||||||
|     @Lazy |     @Lazy | ||||||
|     def virtualTarget(self): |     def virtualTarget(self): | ||||||
|         obj = self.virtualTargetObject |         obj = self.virtualTargetObject | ||||||
|  |  | ||||||
|  | @ -165,8 +165,6 @@ class ResourceView(BaseView): | ||||||
|             context = ti(context) |             context = ti(context) | ||||||
|         data = context.data |         data = context.data | ||||||
|         response = self.request.response |         response = self.request.response | ||||||
|         response.setHeader('Content-Type', context.contentType) |  | ||||||
|         response.setHeader('Content-Length', len(data)) |  | ||||||
|         ct = context.contentType |         ct = context.contentType | ||||||
|         #if useAttachment or (not ct.startswith('image/') and ct != 'application/pdf'): |         #if useAttachment or (not ct.startswith('image/') and ct != 'application/pdf'): | ||||||
|         if useAttachment: |         if useAttachment: | ||||||
|  | @ -175,6 +173,11 @@ class ResourceView(BaseView): | ||||||
|             filename = NameChooser(getParent(self.context)).normalizeName(filename) |             filename = NameChooser(getParent(self.context)).normalizeName(filename) | ||||||
|             response.setHeader('Content-Disposition', |             response.setHeader('Content-Disposition', | ||||||
|                                'attachment; filename=%s' % filename) |                                'attachment; filename=%s' % filename) | ||||||
|  |         response.setHeader('Content-Length', len(data)) | ||||||
|  |         if ct.startswith('text/'): | ||||||
|  |             response.setHeader('Content-Type', 'text/html') | ||||||
|  |             return self.renderText(data, ct) | ||||||
|  |         response.setHeader('Content-Type', ct) | ||||||
|         return data |         return data | ||||||
| 
 | 
 | ||||||
|     def download(self): |     def download(self): | ||||||
|  |  | ||||||
|  | @ -165,6 +165,7 @@ class ResourceAdapterBase(AdapterBase): | ||||||
| 
 | 
 | ||||||
|     storageName = None |     storageName = None | ||||||
|     storageParams = None |     storageParams = None | ||||||
|  |     localFilename = None | ||||||
| 
 | 
 | ||||||
|     def getChildren(self): |     def getChildren(self): | ||||||
|         return [] |         return [] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm