Various minor bugfixes.

This commit is contained in:
Gaetan Delannay 2010-01-20 21:51:17 +01:00
parent 24c0dee96c
commit 3bb907ca5d
4 changed files with 24 additions and 8 deletions

View file

@ -453,6 +453,7 @@ class Publisher:
f.write(toc) f.write(toc)
f.close() f.close()
privateScripts = ('publish.py', 'zip.py', 'runOpenOffice.sh')
def prepareGenFolder(self): def prepareGenFolder(self):
'''Creates the basic structure of the temp folder where the appy '''Creates the basic structure of the temp folder where the appy
website will be generated.''' website will be generated.'''
@ -466,9 +467,12 @@ class Publisher:
os.mkdir(genSrcFolder) os.mkdir(genSrcFolder)
for aFile in ('__init__.py',): for aFile in ('__init__.py',):
shutil.copy('%s/%s' % (appyPath, aFile), genSrcFolder) 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), shutil.copytree('%s/%s' % (appyPath, aFolder),
'%s/%s' % (genSrcFolder, 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)''' # Write the appy version into the code itself (in appy/version.py)'''
print 'Publishing version %s...' % self.versionShort print 'Publishing version %s...' % self.versionShort
# Dump version info in appy/version.py # Dump version info in appy/version.py

View file

@ -162,7 +162,7 @@ class FlavourMixin(AbstractMixin):
elems = [] elems = []
importPath = getattr(self, 'importPathFor%s' % contentType) importPath = getattr(self, 'importPathFor%s' % contentType)
for elem in os.listdir(importPath): for elem in os.listdir(importPath):
elemFullPath = os.path.join(importParams['path'], elem) elemFullPath = os.path.join(importPath, elem)
elemInfo = onElement(elemFullPath) elemInfo = onElement(elemFullPath)
if elemInfo: if elemInfo:
elemInfo.insert(0, elemFullPath) # To the result, I add the full elemInfo.insert(0, elemFullPath) # To the result, I add the full

View file

@ -648,11 +648,18 @@ class ToolMixin(AbstractMixin):
res[urlKey] = None res[urlKey] = None
if needIt: if needIt:
exec 'index = %sIndex' % urlType exec 'index = %sIndex' % urlType
brain = self.uid_catalog(UID=uids[index]) uid = None
if brain: try:
baseUrl = brain[0].getObject().getUrl() uid = uids[index]
navUrl = baseUrl + '/?nav=' + newNav % (index + 1) # uids can be a list (ref) or a dict (search)
res['%sUrl' % urlType] = navUrl 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 return res
def tabularize(self, data, numberOfRows): def tabularize(self, data, numberOfRows):

View file

@ -76,7 +76,12 @@ class AbstractMixin:
rq.SESSION['initiatorField'] = rq.get('field') rq.SESSION['initiatorField'] = rq.get('field')
rq.SESSION['initiatorTarget'] = rq.get('type_name') rq.SESSION['initiatorTarget'] = rq.get('type_name')
if self._appy_meta_type == 'tool': 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: else:
baseUrl = self.absolute_url() baseUrl = self.absolute_url()
objId = self.generateUniqueId(rq.get('type_name')) objId = self.generateUniqueId(rq.get('type_name'))