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+'') 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(srcClass._zbases))+'
Bases of '+dpn+'/'+dpc+'') replace=int(self.REQUEST.get('replace')) if srcClass and destClass and replace: response.append('You just issued a replace operation
'+html_quote(str(destClass._zbases))+'
") 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=""" """ % (getParam(self,['spn','spc','dpn','dpc','replace'])+((getParam(self,['copy'])[0] and 'checked') or ' ',)) return html #