rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
'field': '%(type)sField', | 'field': '%(atype)sField', | def generateFti(self,element,subtypes): ''' ''' |
res+=indent("%s('%s',\n" % (fieldtype,name), indent_level) | res+=indent("%s('%s',\n" % (fieldtype % map,name), indent_level) | def getFieldFormatted(self,name,fieldtype,map={},doc=None,indent_level=0): ''' returns the formatted field definitions for the schema ''' res = '' # add comment if doc: res+=indent(doc,indent_level,'#')+'\n'+res res+=indent("%s('%s',\n" % (fieldtype,name), indent_level) map_keys=map.keys() map_keys.sort() res+=indent('... |
classelement ) | classelement ), 'atype':attr.type.capitalize() | def getFieldStringFromAttribute(self, attr, classelement): ''' gets the schema field code ''' #print 'typename:%s:'%attr.getName(),attr.type, if not hasattr(attr,'type') or attr.type=='NoneType': ctype='string' else: ctype=self.coerceType(str(attr.type)) |
RCS-ID $Id: ArchetypesGenerator.py,v 1.7 2004/05/10 11:57:31 zworkb Exp $ | RCS-ID $Id: ArchetypesGenerator.py,v 1.8 2004/05/10 14:57:06 zworkb Exp $ | def generateInterface(self, outfile, element, delayed): wrt = outfile.write |
log.debug("Printing %s lines of help.", len(help_lines)) | def sample_config(self): """Print sample config file. """ | |
if opt.action == "store_true": if opt.default == 1: print '%s' % name else: print ' elif opt.action == "store_false": if opt.default == 0: print '%s' % name else: print ' elif opt.type=="yesno": | if opt.type=="yesno": log.debug("Printing yes/no option.") | def sample_config(self): """Print sample config file. """ |
atvm = getToolByName(self, 'portal_vocabularies') | from Products.ATVocabularyManager.config import TOOL_NAME as ATVOCABULARYTOOL atvm = getToolByName(self, ATVOCABULARYTOOL) | def install(self): """ External Method to install <dtml-var "package.getProductModuleName()"> """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by con... |
res += self.getFieldFormatted(field_spec['name'], field_spec['fieldtype'], field_spec['map'], field_spec['doc'], field_spec['indent_level'], field_spec['rawType'], field_spec['array_field'], ) except: print "field_specs = '%s'" % field_specs | if (field_spec.has_key('rawType') and field_spec.has_key('array_field')): res += self.getFieldFormatted(field_spec['name'], field_spec['fieldtype'], field_spec['map'], field_spec['doc'], field_spec['indent_level'], field_spec['rawType'], field_spec['array_field'], ) else: res += self.getFieldFormatted(field_spec['name'... | def getFieldsFormatted(self, field_specs): """Return the formatted field definitions for the schema from field_specs. """ res = '' for field_spec in field_specs: log.debug("field_spec is %r.", field_spec) try: res += self.getFieldFormatted(field_spec['name'], field_spec['fieldtype'], field_spec['map'], field_spec['doc'... |
'show_hm'] | 'show_hm', 'move:pos', 'move:top', 'move:bottom'] | def getParent(self, *a, **kw): return None |
indent_level=0, rawType='String'): """Return the formatted field definitions for the schema.""" | indent_level=0, rawType='String', array_field=False): """Return the a formatted field definition for the schema. """ | def getFieldFormatted(self, name, fieldtype, map={}, doc=None, indent_level=0, rawType='String'): """Return the formatted field definitions for the schema.""" log.debug("Trying to get formatted field. name='%s', fieldtype='%s', " "doc='%s', rawType='%s'.", name, fieldtype, doc, rawType) res = '' |
def getFieldString(self, element, classelement, indent_level=0): | def getFieldsFormatted(self, field_specs): """Return the formatted field definitions for the schema from field_specs. """ res = '' for field_spec in field_specs: res += self.getFieldFormatted(**field_spec) return res def getFieldSpec(self, element, classelement, indent_level=0): | def getFieldFormatted(self, name, fieldtype, map={}, doc=None, indent_level=0, rawType='String'): """Return the formatted field definitions for the schema.""" log.debug("Trying to get formatted field. name='%s', fieldtype='%s', " "doc='%s', rawType='%s'.", name, fieldtype, doc, rawType) res = '' |
res = self.getFieldFormatted(element.getCleanName(), self.typeMap[ctype]['field'].copy(), map, indent_level) | res= {'name':element.getCleanName(), 'fieldtype':self.typeMap[ctype]['field'].copy(), 'map':map, 'indent_level':indent_level} | def getFieldString(self, element, classelement, indent_level=0): """Gets the schema field code.""" typename = element.type ctype = self.coerceType(typename) map = typeMap[ctype]['map'].copy() res = self.getFieldFormatted(element.getCleanName(), self.typeMap[ctype]['field'].copy(), map, indent_level) return res |
def getFieldStringFromAttribute(self, attr, classelement, indent_level=0): | def getFieldSpecFromAttribute(self, attr, classelement, indent_level=0): | def getFieldStringFromAttribute(self, attr, classelement, indent_level=0): """Gets the schema field code.""" |
res = self.getFieldFormatted(attr.getName(), atype, map, doc, rawType=attr.getType(), indent_level=indent_level) if attr.getUpperBound() != 1: utils.indent(res, 1) res = """ArrayField(%s),""" % utils.indent(res, 1) | res={'name':attr.getName(), 'fieldtype':atype, 'map':map, 'doc':doc, 'indent_level':indent_level, 'rawType':attr.getType(), 'array_field':attr.getUpperBound() != 1} | def corresponding_error(errormsgs, ind): if errormsgs and errormsgs != ['']: return ", '"+errormsgs[ind]+"'" return "" |
def getFieldStringFromAssociation(self, rel, classelement, indent_level=0): | def getFieldSpecFromAssociation(self, rel, classelement, indent_level=0): | def getFieldStringFromAssociation(self, rel, classelement, indent_level=0): """Return the schema field code.""" |
res=self.getFieldFormatted(name, field, map, doc, indent_level) | res={'name':name, 'fieldtype':field, 'map':map, 'doc':doc, 'indent_level':indent_level} | def getFieldStringFromAssociation(self, rel, classelement, indent_level=0): """Return the schema field code.""" |
def getFieldStringFromBackAssociation(self, rel, classelement, indent_level=0): | def getFieldSpecFromBackAssociation(self, rel, classelement, indent_level=0): | def getFieldStringFromBackAssociation(self, rel, classelement, indent_level=0): """Gets the schema field code""" multiValued = 0 obj = rel.fromEnd.obj name = rel.fromEnd.getName() relname = rel.getName() |
res = self.getFieldFormatted(name, field, map, doc, indent_level) | res={'name':name, 'fieldtype':field, 'map':map, 'doc':doc, 'indent_level':indent_level} | def getFieldStringFromBackAssociation(self, rel, classelement, indent_level=0): """Gets the schema field code""" multiValued = 0 obj = rel.fromEnd.obj name = rel.fromEnd.getName() relname = rel.getName() |
def generateArcheSchema(self, element, base_schema, indent_level=0): | def generateArcheSchema(self, outfile, element, base_schema, field_specs): | def generateArcheSchema(self, element, base_schema, indent_level=0): """ generates the Schema """ # first copy fields from other schemas if neccessary. outfile = StringIO() startmarker = True for attr in element.getAttributeDefs(): if attr.type.lower() == 'copy': if startmarker: startmarker=False print >> outfile, 'cop... |
outfile = StringIO() | def generateArcheSchema(self, element, base_schema, indent_level=0): """ generates the Schema """ # first copy fields from other schemas if neccessary. outfile = StringIO() startmarker = True for attr in element.getAttributeDefs(): if attr.type.lower() == 'copy': if startmarker: startmarker=False print >> outfile, 'cop... | |
aggregatedClasses = [] for attrDef in element.getAttributeDefs(): name = attrDef.getName() mappedName = utils.mapName(name) print >> outfile, self.getFieldStringFromAttribute(attrDef, element, indent_level=indent_level+1) for child in element.getChildren(): name = child.getCleanName() if name in self.reservedAtts:... | print >> outfile, self.getFieldsFormatted(field_specs) | def generateArcheSchema(self, element, base_schema, indent_level=0): """ generates the Schema """ # first copy fields from other schemas if neccessary. outfile = StringIO() startmarker = True for attr in element.getAttributeDefs(): if attr.type.lower() == 'copy': if startmarker: startmarker=False print >> outfile, 'cop... |
return outfile.getvalue() | def generateFieldMoves(self, outfile, schemaName, field_specs): """Generate moveField statements for the schema from field_specs. """ for field_spec in field_specs: if not field_spec.has_key('map'): continue for key in field_spec['map'].keys(): if key.startswith('move:'): move_key = key[5:] move_from = field_spec['nam... | def generateArcheSchema(self, element, base_schema, indent_level=0): """ generates the Schema """ # first copy fields from other schemas if neccessary. outfile = StringIO() startmarker = True for attr in element.getAttributeDefs(): if attr.type.lower() == 'copy': if startmarker: startmarker=False print >> outfile, 'cop... |
print >> outfile, self.generateArcheSchema(element, baseschema) | field_specs = self.getLocalFieldSpecs(element) self.generateArcheSchema(outfile, element, baseschema, field_specs) | def generateArchetypesClass(self, element, **kw): """this is the all singing all dancing core generator logic for a full featured Archetypes class """ log.info("%sGenerating class '%s'.", ' '*self.infoind, element.getName()) |
def getToAssociations(self,aggtypes=['none']): return [a for a in self.assocsTo if a.fromEnd.aggregation in aggtypes] def getFromAssociations(self,aggtypes=['none']): return [a for a in self.assocsFrom if a.fromEnd.aggregation in aggtypes] | def getToAssociations(self,aggtypes=['none'],aggtypesTo=['none']): return [a for a in self.assocsTo if a.fromEnd.aggregation in aggtypes and a.toEnd.aggregation in aggtypesTo] def getFromAssociations(self,aggtypes=['none'],aggtypesTo=['none']): return [a for a in self.assocsFrom if a.fromEnd.aggregation in aggtypes an... | def getToAssociations(self,aggtypes=['none']): return [a for a in self.assocsTo if a.fromEnd.aggregation in aggtypes] |
if type(res) is UnicodeType: res = res.encode('utf-8') log.debug("getName has to fallback to unicode id. " "id=%s. " "Converting to utf-8.", res) | def getName(self): name = str(self.name) if self.name: res = name else: res = self.id | |
if len(args) >= 2: outfileName=args[1] | usage() | def main(): options={} options['version']=version() options['author'] = None options['email'] = None options['copyright'] = None options['licence'] = None options['no_module_info_header'] = None args = sys.argv[1:] opts, args = getopt.getopt(args, 'f:a:t:o:s:p:P:n', ['ape','actions','default-actions','no-actions', 'ap... |
Options: -o <target> Output file directory path for data representation classes. Last part of used for internal directory namings. -P <name1>,<name2>... names of packages to parse in source file -a --actions generates actions (default) --no-actions do not generate... | OPTIONS: -o <target> Output file directory path for data representation classes. Last part is used for internal directory namings. -P <name1>,<name2>... names of packages to parse in source file -a --actions generates actions (default) --no-actions do not generates actions --method-preservation methods in the targ... | def main(): options={} options['version']=version() options['author'] = None options['email'] = None options['copyright'] = None options['licence'] = None options['no_module_info_header'] = None args = sys.argv[1:] opts, args = getopt.getopt(args, 'f:a:t:o:s:p:P:n', ['ape','actions','default-actions','no-actions', 'ap... |
prepend = '' | prepend = indent('', indent_level) | def getFieldFormatted(self,name,fieldtype,map={},doc=None, indent_level=0, rawType='String'): """Return the formatted field definitions for the schema. """ |
res+=indent('%s%s=%s' % (prepend, key, firstline), indent_level+1) | res+='%s%s=%s' % (prepend, key, firstline) | def getFieldFormatted(self,name,fieldtype,map={},doc=None, indent_level=0, rawType='String'): """Return the formatted field definitions for the schema. """ |
res += "\n%s" % line prepend = ',\n' res+=indent('),\n', indent_level) | res += "\n%s" % indent(line, indent_level+1) prepend = ',\n%s' % indent('', indent_level+1) res+='\n%s' % indent('),\n', indent_level) | def getFieldFormatted(self,name,fieldtype,map={},doc=None, indent_level=0, rawType='String'): """Return the formatted field definitions for the schema. """ |
if code: | if code and mode=='class': | print >> outfile,' def %s(%s):' % (m.getName(),paramstr[1:]) |
{'baseclass_interfaces' : ' + '.join(['%s.__implements__' % i for i in parents.split(',')]), | {'baseclass_interfaces' : ' + '.join(["getattr(%s,'__implements__',())" % i for i in parents.split(',')]), | def generateClass(self, outfile, element, delayed): wrt = outfile.write wrt('\n') |
res.union(c.getFromAssociations()) | res.union_update(c.getFromAssociations()) | def getAssociations(self, recursive=0): classes = self.getClassesAndInterfaces(recursive=recursive) res = Set() for c in classes: res.union(c.getFromAssociations()) return res |
used_for=('<dtml-var "klass.getTaggedValue('description', 'Products.Archetypes.Field.StringField')">',) | used_for=('<dtml-var "klass.getTaggedValue('used_for', 'Products.Archetypes.Field.StringField')">',) | def <dtml-var "m.getName()">(self,<dtml-var "','.join(m.getParamNames())">): pass |
res = [] | res = Set() | def getAssociations(self, recursive=0): classes = self.getClassesAndInterfaces(recursive=recursive) res = [] for c in classes: res.extend(c.getFromAssociations()) return res |
res.extend(c.getFromAssociations()) | res.union(c.getFromAssociations()) | def getAssociations(self, recursive=0): classes = self.getClassesAndInterfaces(recursive=recursive) res = [] for c in classes: res.extend(c.getFromAssociations()) return res |
print >> outfile,self.TEMPL_CONSTR_TOOL % (baseclass,'portal_'+element.getName().lower()) | tool_instance_name=element.getTaggedValue('tool_instance_name') or 'portal_'+element.getName().lower() print >> outfile,self.TEMPL_CONSTR_TOOL % (baseclass,tool_instance_name) | def generateClasses(self, outfile, element, delayed): wrt = outfile.write wrt('\n') parentnames = [p.getCleanName() for p in element.getGenParents()] for p in parentnames: print >> outfile,'from %s import %s' % (p,p) |
'tool_instance':'portal_'+c.getName().lower(), | 'tool_instance': tool_instance_name, | def generateStdFiles(self, target,projectName,generatedModules): #generates __init__.py, Extensions/Install.py and the skins directory #the result is a QuickInstaller installable product |
'configlet_url':'portal_'+c.getName().lower()+configlet_view, | 'configlet_url':tool_instance_name+configlet_view, | def generateStdFiles(self, target,projectName,generatedModules): #generates __init__.py, Extensions/Install.py and the skins directory #the result is a QuickInstaller installable product |
help="Support for i18NArchetypes. Attributes with a stereotype of 'i18n'" " or taggedValue of i18n=1 will be multilingual (default is 0).", type="yesno", | help="Support for internationalised archetypes." "Attributes with a stereotype of 'i18n' " "or taggedValue of i18n=1 will be multilingual. " "Possible values for this option are 'linguaplone' " "and 'i18n-archetypes'.", type="string", | def handle_option_from_file(self, option_in_file, value_in_file, settings): |
default=0, | default='', | def handle_option_from_file(self, option_in_file, value_in_file, settings): |
m=objects[masterid] | m=objects.get(masterid,None) | def buildRelations(self, doc, objects): #XXX: needs refactoring rels=doc.getElementsByTagName(XMI.ASSOCIATION) for rel in rels: master=None detail=None ends=rel.getElementsByTagName(XMI.ASSOCEND) #assert len(ends)==2 if len(ends) != 2: #print 'association with != 2 ends found' continue |
'XMIParser.XMIMethod': ['method', 'action'], | 'XMIParser.XMIMethod': ['method', 'action/form/view'], | def __init__(self): """ Initialise an empty registry """ |
self.errQuote(self.__name__)) | MyErrQuote) | def parse_error(self, mess, tag, text, start): raise ParseError, "%s, for tag %s, on line %s of %s<p>" % ( mess, self.errQuote(tag), len(text[:start].split('\n')), self.errQuote(self.__name__)) |
def beforeUninstall(self): """ try to call a custom beforeUninstall method in 'AppInstall.py' | def beforeUninstall(self, reinstall, product, cascade): """ try to call a custom beforeUninstall method in 'AppInstall.py' | def beforeUninstall(self): """ try to call a custom beforeUninstall method in 'AppInstall.py' method 'beforeUninstall' """ try: beforeuninstall = ExternalMethod('temp', 'temp', PROJECTNAME+'.AppInstall', 'beforeUninstall') except: beforeuninstall = None if beforeuninstall: print >>out, 'Custom beforeUninstall:' res = ... |
beforeuninstall = None | beforeuninstall = [] | def beforeUninstall(self): """ try to call a custom beforeUninstall method in 'AppInstall.py' method 'beforeUninstall' """ try: beforeuninstall = ExternalMethod('temp', 'temp', PROJECTNAME+'.AppInstall', 'beforeUninstall') except: beforeuninstall = None if beforeuninstall: print >>out, 'Custom beforeUninstall:' res = ... |
res = beforeuninstall(self) | res = beforeuninstall(self, reinstall=reinstall , product=product , cascade=cascade) | def beforeUninstall(self): """ try to call a custom beforeUninstall method in 'AppInstall.py' method 'beforeUninstall' """ try: beforeuninstall = ExternalMethod('temp', 'temp', PROJECTNAME+'.AppInstall', 'beforeUninstall') except: beforeuninstall = None if beforeuninstall: print >>out, 'Custom beforeUninstall:' res = ... |
def afterInstall(self): """ try to call a custom afterInstall method in 'AppInstall.py' method | return (out,cascade) def afterInstall(self, reinstall, product): """ try to call a custom afterInstall method in 'AppInstall.py' method | def beforeUninstall(self): """ try to call a custom beforeUninstall method in 'AppInstall.py' method 'beforeUninstall' """ try: beforeuninstall = ExternalMethod('temp', 'temp', PROJECTNAME+'.AppInstall', 'beforeUninstall') except: beforeuninstall = None if beforeuninstall: print >>out, 'Custom beforeUninstall:' res = ... |
if self.getOption('relation_implementation',rel,'basic'): | if self.getOption('relation_implementation',rel,'basic') == 'relations': | def generateAdditionalImports(self, element): outfile=StringIO() |
import pdb;pdb.set_trace() | def generateArchetypesClass(self, element,**kw): print indent('Generating class: '+element.getName(),self.infoind) | |
creation_permission = self.getOption('creation_permission', package, package.getProductName().capitalize()) | creation_permission = self.getOption('creation_permission', package, None) or \ package.getProductName().capitalize() | def generateConfigPy(self, package): """ generates: config.py """ |
if name == 'license': log.debug("Skipping over multi-line license. Need to figure out how to deal with that.") continue | def sample_config(self): """Print sample config file. """ | |
group.add_option("--rcs_id", | group.add_option("--rcs-id", | def handle_option_from_file(self, option_in_file, value_in_file, settings): |
help="Set default licence (default is the GPL).", default=codesnippets.GPLTEXT, | help="Set default license (default is the GPL).", default='GPL', | def handle_option_from_file(self, option_in_file, value_in_file, settings): |
type="string", | type="choice", choices=codesnippets.LICENSES.keys(), | def handle_option_from_file(self, option_in_file, value_in_file, settings): |
mod=PyParser.PyModule(outfilepath) | mod=PyParser.PyModule(os.path.join(self.targetRoot,outfilepath)) | def generatePackage(self,package,recursive=1): package.generatedModules=[] package.generatedClasses=[] if package.getName() == 'java': #to suppress these unneccesary implicit created java packages (ArcgoUML and Poseidon) return self.makeDir(package.getFilePath()) for element in package.getClasses()+package.getInterfa... |
wrt('from %s import %s' % (p,p)) wrt('\n') | print >> outfile,'from %s import %s' % (p,p) | def generateClasses(self, outfile, element, delayed): wrt = outfile.write wrt('\n') parentnames = [p.getCleanName() for p in element.getGenParents()] for p in parentnames: wrt('from %s import %s' % (p,p)) |
'boolean':'''BooleanField('%(name)s', | 'fixedpoint':'''FixedPointField('%(name)s', %(other)s ),''', 'boolean':'''BooleanField('%(name)s', | def generateFti(self,element,subtypes): ''' ''' |
elif self.detailled_creation_permissions: creation_permission = "'Add %ss'" + ftis[i]['id'].capitalize() | def generateClass(self, outfile, element, delayed): print indent('generating class: '+element.getName(),self.infoind) | |
if navtreeProperties is not None: navtreeProperties.idsNotToList = list(navtreeProperties.idsNotToList) + \ [toolname for toolname in <dtml-var "[t.getTaggedValue('tool_instance_name') or 'portal_%s' % t.getName().lower() for t in all_tools]"> \ if toolname not in navtreeProperties.idsNotToList] | if navtreeProperties is not None and navtreeProperties.hasProperty('idsNotToList'): for toolname in <dtml-var "[t.getTaggedValue('tool_instance_name') or 'portal_%s' % t.getName().lower() for t in all_tools]">: current = list(navtreeProperties.getProperty('idsNotToList')) if toolname not in current: current.append(tool... | def install(self): """ External Method to install <dtml-var "package.getProductModuleName()"> """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by con... |
if navtreeProperties is not None: navtreeProperties.idsNotToList = list(navtreeProperties.idsNotToList) for toolname in [toolname for toolname in <dtml-var "[t.getTaggedValue('tool_instance_name') or 'portal_%s' % t.getName().lower() for t in all_tools]"> \ if toolname not in navtreeProperties.idsNotToList]: if toolnam... | if navtreeProperties is not None and navtreeProperties.hasProperty('idsNotToList'): for toolname in <dtml-var "[t.getTaggedValue('tool_instance_name') or 'portal_%s' % t.getName().lower() for t in all_tools]">: current = list(navtreeProperties.getProperty('idsNotToList')) if toolname in current: current.remove(toolname... | def uninstall(self): out = StringIO() |
print >> outfile, CLASS_FOLDER_TABS % 1 | print >> outfile, CLASS_FOLDER_TABS % 0 | def generateArchetypesClass(self, element, **kw): """this is the all singing all dancing core generator logic for a full featured Archetypes class """ log.info("%sGenerating class '%s'.", ' '*self.infoind, element.getName()) |
allow_discussion = element.getTaggedValue('allow_discussion', False) | def generateFti(self, element, subtypes): ''' generates Factory Type Information related attributes on the class''' | |
'allow_discussion' : allow_discussion, | def generateFti(self, element, subtypes): ''' generates Factory Type Information related attributes on the class''' | |
except: raise | except NotFound: | def install(self): portal=getToolByName(self,'portal_url').getPortalObject() out = StringIO() classes=listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Successfully installed %%s." %% PROJECTNAME sr = PloneSkinRegistrar('skins', product_globals) print >> out,sr.install(self) #sr = Plo... |
RCS-ID $Id: ArchGenXML.py,v 1.142 2004/04/21 22:14:41 yenzenz Exp $ | RCS-ID $Id: ArchGenXML.py,v 1.143 2004/04/22 00:35:45 xiru Exp $ | def generateInterface(self, outfile, element, delayed): wrt = outfile.write |
'label': "'%s'" % fieldname.capitalize(), | 'label': "'%s'" % fieldname, | def getWidget(self, type, element, fieldname, elementclass): """ returns either default widget, widget according to attributes or no widget. atributes/tgv's can be: * widget and a whole widget code block or * widget:PARAMETER which will be rendered as a PARAMETER=value """ tgv=element.getTaggedValues() widgetcode = t... |
self.typeMap[ctype]['field'], self.typeMap[ctype]['map'] ) | self.typeMap[ctype]['field'].copy(), self.typeMap[ctype]['map'].copy() ) | def getFieldString(self, element, classelement): ''' gets the schema field code ''' typename=str(element.type) |
map=self.typeMap[ctype]['map'] | map=self.typeMap[ctype]['map'].copy() | def getFieldStringFromAttribute(self, attr, classelement): ''' gets the schema field code ''' #print 'typename:%s:'%attr.getName(),attr.type, if not hasattr(attr,'type') or attr.type=='NoneType': ctype='string' else: ctype=self.coerceType(str(attr.type)) |
map=self.typeMap['reference']['map'] | map=self.typeMap['reference']['map'].copy() | def getFieldStringFromAssociation(self, rel, classelement): ''' gets the schema field code ''' multiValued=0 map=self.typeMap['reference']['map'] obj=rel.toEnd.obj name=rel.toEnd.getName() relname=rel.getName() field=rel.getTaggedValue('reference_field') or self.typeMap['reference']['field'] #the relation can override ... |
RCS-ID $Id: ArchGenXML.py,v 1.139 2004/04/21 12:08:18 yenzenz Exp $ | RCS-ID $Id: ArchGenXML.py,v 1.140 2004/04/21 15:12:40 yenzenz Exp $ | def generateInterface(self, outfile, element, delayed): wrt = outfile.write |
package,forcePluginRoot=self.force_plugin_root | package, forcePluginRoot=self.force_plugin_root, includeRoot=0, | def generateDependentImports(self,element): outfile=StringIO() package=element.getPackage() |
vertext=vertext.strip() | versionbase=vertext=vertext.strip() | def updateVersionForProduct(self,package): ''' ''' build=1 versionbase='0.1' fp=os.path.join(package.getFilePath(),'version.txt') vertext=self.readFile(fp) if vertext: vertext=vertext.strip() parsed=vertext.split(' ') if parsed.count('build'): ind=parsed.index('build') try: build=int(parsed[ind+1]) + 1 except: build=1 ... |
vocaboptions['container_type'], vocaboptions['item_type']) | vocaboptions['vocabulary_type'], vocaboptions['term_type']) | def getFieldStringFromAttribute(self, attr, classelement): ''' gets the schema field code ''' #print 'typename:%s:'%attr.getName(),attr.type, if not hasattr(attr,'type') or attr.type=='NoneType': ctype='string' else: ctype=self.coerceType(str(attr.type)) |
return self.MODIFY_FTI % {'hideactions':hide_actions, } | return MODIFY_FTI % {'hideactions':hide_actions, } | def generateModifyFti(self,element): hide_actions=element.getTaggedValue('hide_actions', '').strip() if not hide_actions: return '' hide_actions=', '.join(["'"+a.strip()+"'" for a in hide_actions.split('\n')]) print 'hide actions: ', hide_actions return self.MODIFY_FTI % {'hideactions':hide_actions, } |
FTI_TEMPL='''\ filter_content_types = %(filter_content_types)d global_allow = %(global_allow)d allow_discussion = %(allow_discussion)s %(has_content_icon)scontent_icon = '%(content_icon)s' immediate_view = '%(immediate_view)s' default_view = '%(defau... | FTI_TEMPL = """\ filter_content_types = %(filter_content_types)d global_allow = %(global_allow)d allow_discussion = %(allow_discussion)s %(has_content_icon)scontent_icon = '%(content_icon)s' immediate_view = '%(immediate_view)s' default_view = '%(default_view)s' suppl_views = %(suppl_views)s typeDescription = %(typeDes... | def modify_fti(fti): # hide unnecessary tabs (usability enhancement) for a in fti['actions']: if a['id'] in [%(hideactions)s]: a['visible'] = 0 return fti |
StringField('id', | StringField( name='id', | def modify_fti(fti): # hide unnecessary tabs (usability enhancement) for a in fti['actions']: if a['id'] in [%(hideactions)s]: a['visible'] = 0 return fti |
mode="r", accessor="getId", mutator="setId", | mode='r', accessor='getId', mutator='setId', | def modify_fti(fti): # hide unnecessary tabs (usability enhancement) for a in fti['actions']: if a['id'] in [%(hideactions)s]: a['visible'] = 0 return fti |
StringField('title', | StringField( name='title', | def modify_fti(fti): # hide unnecessary tabs (usability enhancement) for a in fti['actions']: if a['id'] in [%(hideactions)s]: a['visible'] = 0 return fti |
CLASS_RENAME_AFTER_CREATION = ''' _at_rename_after_creation = %s\n''' REGISTER_ARCHTYPE = """registerType(%s,PROJECTNAME)\n""" IMPORT_INTERFACE = """from Interface import Base""" MODULE_INFO_HEADER = """\ | CLASS_RENAME_AFTER_CREATION = ''' _at_rename_after_creation = %s\n''' REGISTER_ARCHTYPE = """registerType(%s,PROJECTNAME)\n""" IMPORT_INTERFACE = """from Interface import Base""" MODULE_INFO_HEADER = '''\ | def ApeSerializer(): return constructSerializer(%(class_name)s) |
__author__ = '''%(authorline)s''' | __author__ = """%(authorline)s""" | def ApeSerializer(): return constructSerializer(%(class_name)s) |
Copyright (c) %s by %s""" | ''' COPYRIGHT = """Copyright (c) %s by %s""" | def ApeSerializer(): return constructSerializer(%(class_name)s) |
GNU General Public Licence (GPL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that i... | LGPLTEXT = """\ BSDTEXT = """\ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * ... | def ApeSerializer(): return constructSerializer(%(class_name)s) |
'field': '%(atype)sField', | 'field': '%(type)sField', | def generateFti(self,element,subtypes): ''' ''' |
def getFieldFormatted(self,name,fieldtype,map={},doc=None,indent_level=0): | def getFieldFormatted(self,name,fieldtype,map={},doc=None, fieldType='String', indent_level=0): | def getFieldFormatted(self,name,fieldtype,map={},doc=None,indent_level=0): ''' returns the formatted field definitions for the schema ''' res = '' # add comment if doc: res+=indent(doc,indent_level,'#')+'\n'+res res+=indent("%s('%s',\n" % (fieldtype % map,name), indent_level) map_keys=map.keys() map_keys.sort() res+=in... |
res+=indent("%s('%s',\n" % (fieldtype % map,name), indent_level) | res+=indent("%s('%s',\n" % (fieldtype % {'type':fieldType.capitalize()},name), indent_level) | def getFieldFormatted(self,name,fieldtype,map={},doc=None,indent_level=0): ''' returns the formatted field definitions for the schema ''' res = '' # add comment if doc: res+=indent(doc,indent_level,'#')+'\n'+res res+=indent("%s('%s',\n" % (fieldtype % map,name), indent_level) map_keys=map.keys() map_keys.sort() res+=in... |
'atype':attr.type.capitalize() | def getFieldStringFromAttribute(self, attr, classelement): ''' gets the schema field code ''' #print 'typename:%s:'%attr.getName(),attr.type, if not hasattr(attr,'type') or attr.type=='NoneType': ctype='string' else: ctype=self.coerceType(str(attr.type)) | |
doc ) | doc, fieldType=attr.getType() ) | def getFieldStringFromAttribute(self, attr, classelement): ''' gets the schema field code ''' #print 'typename:%s:'%attr.getName(),attr.type, if not hasattr(attr,'type') or attr.type=='NoneType': ctype='string' else: ctype=self.coerceType(str(attr.type)) |
RCS-ID $Id: ArchetypesGenerator.py,v 1.8 2004/05/10 14:57:06 zworkb Exp $ | RCS-ID $Id: ArchetypesGenerator.py,v 1.9 2004/05/10 15:25:25 zworkb Exp $ | def generateInterface(self, outfile, element, delayed): wrt = outfile.write |
atvm[vocabname].invokeFactory(vocabmap[vocabname][1],'default') atvm[vocabname]['default'].setTitle('Default term, replace it by your own stuff') | pass | def install(self): """ External Method to install <dtml-var "package.getProductModuleName()"> """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by con... |
of=self.makeFile(os.path.join(target,'__init__.py')) | of=self.makeFile(os.path.join(package.getFilePath(),'__init__.py')) | def generateStdFilesForProduct(self, target,package): generatedModules=package.generatedModules #generates __init__.py, Extensions/Install.py and the skins directory #the result is a QuickInstaller installable product print 'stdfiles for ',package.getName() #remove trailing slash if target[-1] in ('/','\\'): target=tar... |
extDir=os.path.join(target,'Extensions') | extDir=os.path.join(package.getFilePath(),'Extensions') | def generateStdFilesForProduct(self, target,package): generatedModules=package.generatedModules #generates __init__.py, Extensions/Install.py and the skins directory #the result is a QuickInstaller installable product print 'stdfiles for ',package.getName() #remove trailing slash if target[-1] in ('/','\\'): target=tar... |
copy(os.path.join(templdir,'tool.gif'), os.path.join(target,'tool.gif') ) | copy(os.path.join(templdir,'tool.gif'), os.path.join(self.targetRoot,package.getFilePath(),'tool.gif') ) | def generateStdFilesForProduct(self, target,package): generatedModules=package.generatedModules #generates __init__.py, Extensions/Install.py and the skins directory #the result is a QuickInstaller installable product print 'stdfiles for ',package.getName() #remove trailing slash if target[-1] in ('/','\\'): target=tar... |
of.write(installTemplate % {'project_dir':os.path.split(target)[1], | of.write(installTemplate % {'project_dir':package.getProductName(), | def generateStdFilesForProduct(self, target,package): generatedModules=package.generatedModules #generates __init__.py, Extensions/Install.py and the skins directory #the result is a QuickInstaller installable product print 'stdfiles for ',package.getName() #remove trailing slash if target[-1] in ('/','\\'): target=tar... |
print >> outfile, '\n | print >> outfile, '\n interface.getName() | def generateMethods(self, outfile, element, mode='class'): print >> outfile,' # Methods' |
allmethnames.append(m.getName()) | def generateMethods(self, outfile, element, mode='class'): print >> outfile,' # Methods' | |
print >> outfile, utils.indent("security.declareProtected(%s, '%s')" % (permission, m.getName()), 1) | print >> outfile, utils.indent("security.declareProtected" "(%s, '%s')" % (permission, m.getName()), 1) | def generateMethod(self, outfile, m, klass, mode='class'): #ignore actions and views here because they are generated separately if m.hasStereoType(['action','view','form','portlet_view', 'portlet'], umlprofile=self.uml_profile): return |
print >> outfile, utils.indent("security.declarePublic('%s')" % m.getName(), 1) | print >> outfile, utils.indent("security.declarePublic" "('%s')" % m.getName(), 1) | def generateMethod(self, outfile, m, klass, mode='class'): #ignore actions and views here because they are generated separately if m.hasStereoType(['action','view','form','portlet_view', 'portlet'], umlprofile=self.uml_profile): return |
print >> outfile,utils.indent(" | print >> outfile,utils.indent(" "defaults", 1) | def generateMethod(self, outfile, m, klass, mode='class'): #ignore actions and views here because they are generated separately if m.hasStereoType(['action','view','form','portlet_view', 'portlet'], umlprofile=self.uml_profile): return |
log.warn("Method visibility should be 'public', 'private', 'protected' or 'package', got '%s'.", permissionMode) else: print >> outfile cls = self.parsed_class_sources.get(klass.getPackage().getFilePath()+'/'+klass.getName(), None) | log.warn("Method visibility should be 'public', 'private', " "'protected' or 'package', got '%s'.", permissionMode) cls = self.parsed_class_sources.get(klass.getPackage().getFilePath() + '/' + klass.getName(), None) | def generateMethod(self, outfile, m, klass, mode='class'): #ignore actions and views here because they are generated separately if m.hasStereoType(['action','view','form','portlet_view', 'portlet'], umlprofile=self.uml_profile): return |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.