X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/ed8a0bfdc8a80311c5dee3bb668865619406021d..26f695c080134260ae2133136b62048dcd43c376:/skins/lrservice.py?ds=sidebyside 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()])