import string from DocumentTemplate.DT_Util import html_quote def t(self): #return form(self) #app=self.REQUEST.PARENTS[-1] #m=getattr(app.Control_Panel.Products.y2Learn.y2Learn_AnnounceFolder.propertysheets,'methods') #return [m['y2Learn_Announce']];#hasProperty('y2Learn_Announce') #.y2Learn_AnnounceFolder go=self.REQUEST.get('go') #set go=1 to really do the task response=[] srcClass=None spn=self.REQUEST.get('spn') #source product name spc=self.REQUEST.get('spc') #source class name spcs=[] if not spn: spn='y2FUN' if not spc: spc='y2FUNBaseClass' if spc : spcs=string.split(spc,'/') if spn and len(spcs) : srcClass=getZClass(self,spn,spcs) response.append('Source Class:'+str(spn)+'/'+str(spc)+'
'+html_quote(str(srcClass))) if srcClass: response.append('
Bases of '+spn+'/'+spc+'
'+html_quote(str(srcClass._zbases))+'
') destClass=None dpcs=[] dpn=self.REQUEST.get('dpn') #product name dpc=self.REQUEST.get('dpc') #class name if dpc : dpcs=string.split(dpc,'/') #return dpcs if dpn and len(dpcs) : destClass=getZClass(self,dpn,dpcs) #return dpcs; response.append('Destination Class:'+str(dpn)+'/'+str(dpc)+'
'+html_quote(str(destClass))) if destClass :response.append('
Bases of '+dpn+'/'+dpc+'
'+html_quote(str(destClass._zbases))+'
') replace=int(self.REQUEST.get('replace')) if srcClass and destClass and replace: response.append('You just issued a replace operation
') newbases=destClass._zbases[:] response.append('To be replaced object is '+html_quote(str(newbases[replace]))) if newbases[replace] is srcClass: response.append('They are the same object, you probably don\'t need to do this') newbases[replace]=srcClass if go: destClass._setBasesHoldOnToYourButts(newbases[1:]) response.append('After Replace at idx='+str(replace)+', Bases of Dest. Class:
'+html_quote(str(destClass._zbases))) elif destClass and srcClass and self.REQUEST.has_key('copy') : response.append('You just issued a copy operation
') newbases=srcClass._zbases[:] if go: destClass._setBasesHoldOnToYourButts(srcClass._zbases[1:]) response.append('After Copy,\nBases of Dest. Class:
'+html_quote(str(destClass._zbases))) response_html=string.join(response,"

") return ''+response_html+''+form(self)+'' def getZClass(self,pn,pcs): P=None app=self.REQUEST.PARENTS[-1] if hasattr(app.Control_Panel.Products,pn): P=getattr(app.Control_Panel.Products[pn],pn) if hasattr(P,pcs[0]): P=getattr(P,pcs[0]) #return P else: return None try: for pc in pcs[1:]: P=P.propertysheets.methods[pc] if not P : return None except KeyError: return None return P def getParam(self,keys): v=[] for k in keys: try: v.append(self.REQUEST[k]) except KeyError: v.append('') return tuple(v) def form(self): html="""

Source
Product:
ZClass: ClassA/ClassB is acceptable
Destination
Product:
ZClass:
Replace At
Do Copy
""" % (getParam(self,['spn','spc','dpn','dpc','replace'])+((getParam(self,['copy'])[0] and 'checked') or ' ',)) return html #