method = fg('method')
if method == 'normaliseAndCreatePath' :
- normalizedPath = []
+ normalizedPath, uids = [], []
o = portal
- path = fg('path', '').split('/')
+ path = fg('path', '').split(' ') # séparateur : 0x09 (tabulation)
for part in path :
validId = makeValidId(o, part, allow_dup=1)
if o.hasObject(validId) :
id = o.invokeFactory('Portfolio', validId, title=part)
o = o[id]
normalizedPath.append(id)
+ uid = uidtool.register(o)
+ uids.append(uid)
- return '/'.join(normalizedPath)
+ return '%s\n%s' % ('/'.join(normalizedPath), ' '.join([str(uid) for uid in uids]))
elif method == 'uploadPhoto' :
path = fg('normalizedPath')
photo = portfolio[photoId]
uid = uidtool.register(photo)
return '%s %s' % (uid, photo.absolute_url())
+
+elif method in ('deletePhoto', 'deletePortfolio') :
+ o = uidtool.queryObject(fg('uid'))
+ if o :
+ parent = o.getParentNode()
+ parent.manage_delObjects([o.getId()])