X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/ed8a0bfdc8a80311c5dee3bb668865619406021d..b13519b8cb7ff427fa1c5ac509a6c58ac6bcadf4:/skins/lrservice.py diff --git a/skins/lrservice.py b/skins/lrservice.py index 821bad1..8b56499 100644 --- a/skins/lrservice.py +++ b/skins/lrservice.py @@ -12,9 +12,9 @@ fg = context.REQUEST.form.get 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) : @@ -24,8 +24,10 @@ if method == 'normaliseAndCreatePath' : 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') @@ -43,3 +45,9 @@ elif method == 'uploadPhoto' : 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()])