diff --git a/bin/publish.py b/bin/publish.py index 5cf7b16..052f906 100755 --- a/bin/publish.py +++ b/bin/publish.py @@ -453,6 +453,7 @@ class Publisher: f.write(toc) f.close() + privateScripts = ('publish.py', 'zip.py', 'runOpenOffice.sh') def prepareGenFolder(self): '''Creates the basic structure of the temp folder where the appy website will be generated.''' @@ -466,9 +467,12 @@ class Publisher: os.mkdir(genSrcFolder) for aFile in ('__init__.py',): shutil.copy('%s/%s' % (appyPath, aFile), genSrcFolder) - for aFolder in ('gen', 'pod', 'shared'): + for aFolder in ('gen', 'pod', 'shared', 'bin'): shutil.copytree('%s/%s' % (appyPath, aFolder), '%s/%s' % (genSrcFolder, aFolder)) + # Remove some scripts from bin + for script in self.privateScripts: + os.remove('%s/bin/%s' % (genSrcFolder, script)) # Write the appy version into the code itself (in appy/version.py)''' print 'Publishing version %s...' % self.versionShort # Dump version info in appy/version.py diff --git a/gen/plone25/mixins/FlavourMixin.py b/gen/plone25/mixins/FlavourMixin.py index 5a67ad6..20f368c 100644 --- a/gen/plone25/mixins/FlavourMixin.py +++ b/gen/plone25/mixins/FlavourMixin.py @@ -162,7 +162,7 @@ class FlavourMixin(AbstractMixin): elems = [] importPath = getattr(self, 'importPathFor%s' % contentType) for elem in os.listdir(importPath): - elemFullPath = os.path.join(importParams['path'], elem) + elemFullPath = os.path.join(importPath, elem) elemInfo = onElement(elemFullPath) if elemInfo: elemInfo.insert(0, elemFullPath) # To the result, I add the full diff --git a/gen/plone25/mixins/ToolMixin.py b/gen/plone25/mixins/ToolMixin.py index 3827826..252a81c 100644 --- a/gen/plone25/mixins/ToolMixin.py +++ b/gen/plone25/mixins/ToolMixin.py @@ -648,11 +648,18 @@ class ToolMixin(AbstractMixin): res[urlKey] = None if needIt: exec 'index = %sIndex' % urlType - brain = self.uid_catalog(UID=uids[index]) - if brain: - baseUrl = brain[0].getObject().getUrl() - navUrl = baseUrl + '/?nav=' + newNav % (index + 1) - res['%sUrl' % urlType] = navUrl + uid = None + try: + uid = uids[index] + # uids can be a list (ref) or a dict (search) + except KeyError: pass + except IndexError: pass + if uid: + brain = self.uid_catalog(UID=uid) + if brain: + baseUrl = brain[0].getObject().getUrl() + navUrl = baseUrl + '/?nav=' + newNav % (index + 1) + res[urlKey] = navUrl return res def tabularize(self, data, numberOfRows): diff --git a/gen/plone25/mixins/__init__.py b/gen/plone25/mixins/__init__.py index c3b37cd..0a4da9a 100644 --- a/gen/plone25/mixins/__init__.py +++ b/gen/plone25/mixins/__init__.py @@ -76,7 +76,12 @@ class AbstractMixin: rq.SESSION['initiatorField'] = rq.get('field') rq.SESSION['initiatorTarget'] = rq.get('type_name') if self._appy_meta_type == 'tool': - baseUrl = self.getAppFolder().absolute_url() + if rq.get('initiator', None): + # This is the creation of an object linked to the tool + baseUrl = self.absolute_url() + else: + # This is the creation of a root object in the app folder + baseUrl = self.getAppFolder().absolute_url() else: baseUrl = self.absolute_url() objId = self.generateUniqueId(rq.get('type_name'))