update IntIds utility on rename; always use '@@' prefix for views
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3857 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									b1a231f40e
								
							
						
					
					
						commit
						4b33b8f9d4
					
				
					 3 changed files with 13 additions and 7 deletions
				
			
		|  | @ -70,7 +70,7 @@ | ||||||
|       <tal:show condition="view/showEditButton"> |       <tal:show condition="view/showEditButton"> | ||||||
|         <div> </div> |         <div> </div> | ||||||
|         <div> |         <div> | ||||||
|           <a tal:attributes="href string:${context/absolute_url}/edit.html">Edit</a> |           <a tal:attributes="href string:${context/absolute_url}/@@edit.html">Edit</a> | ||||||
|         </div> |         </div> | ||||||
|       </tal:show> |       </tal:show> | ||||||
|     </div> |     </div> | ||||||
|  |  | ||||||
|  | @ -102,7 +102,7 @@ class CreatePage(object): | ||||||
|         for link in lm.query(name=name): |         for link in lm.query(name=name): | ||||||
|             if link.target is None: |             if link.target is None: | ||||||
|                 link.update(target=page) |                 link.update(target=page) | ||||||
|         self.request.response.redirect('%s/edit.html' % |         self.request.response.redirect('%s/@@edit.html' % | ||||||
|                 absoluteURL(page, self.request)) |                 absoluteURL(page, self.request)) | ||||||
|         return False |         return False | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ from BTrees.OOBTree import OOBTree | ||||||
| from persistent.mapping import PersistentMapping | from persistent.mapping import PersistentMapping | ||||||
| from zope.app.intid import IntIds | from zope.app.intid import IntIds | ||||||
| from zope.app.intid.interfaces import IIntIds | from zope.app.intid.interfaces import IIntIds | ||||||
|  | from zope.app.keyreference.interfaces import IKeyReference | ||||||
| from zope.cachedescriptors.property import Lazy | from zope.cachedescriptors.property import Lazy | ||||||
| from zope import component | from zope import component | ||||||
| from zope.component import adapts | from zope.component import adapts | ||||||
|  | @ -89,12 +90,8 @@ class WikiManager(BaseWikiManager): | ||||||
|             self.wikiUids.remove(uid) |             self.wikiUids.remove(uid) | ||||||
| 
 | 
 | ||||||
|     def renameWiki(self, wiki, newName): |     def renameWiki(self, wiki, newName): | ||||||
|         intIds = self.getPlugin(IIntIds) |  | ||||||
|         self.removeWiki(wiki) |  | ||||||
|         intIds.unregister(wiki) |  | ||||||
|         wiki.rename(newName) |         wiki.rename(newName) | ||||||
|         intIds.register(wiki) |         moveKeyReference(self.getPlugin(IIntIds), wiki) | ||||||
|         self.addWiki(wiki) |  | ||||||
| 
 | 
 | ||||||
|     def listWikis(self): |     def listWikis(self): | ||||||
|         for uid in self.wikiUids: |         for uid in self.wikiUids: | ||||||
|  | @ -166,3 +163,12 @@ class LinkManager(BaseLinkManager): | ||||||
| 
 | 
 | ||||||
|     def getObject(self, uid): |     def getObject(self, uid): | ||||||
|         return self.manager.getObject(uid) |         return self.manager.getObject(uid) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def moveKeyReference(intIds, obj): | ||||||
|  |     """ Make sure entry in intIds utility is updated after a move or rename. | ||||||
|  |     """ | ||||||
|  |     key = IKeyReference(obj) | ||||||
|  |     uid = intIds.getId(obj) | ||||||
|  |     intIds.refs[uid] = key | ||||||
|  |     intIds.ids[key] = uid | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm