X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/3c8d6d0806a542a7337c121c2ba06d2824b7e074..8e1a01f483d5572199464ed072747ba998bb978f:/skins/lrservice.py?ds=sidebyside diff --git a/skins/lrservice.py b/skins/lrservice.py index fad05e8..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') @@ -44,8 +46,8 @@ elif method == 'uploadPhoto' : uid = uidtool.register(photo) return '%s %s' % (uid, photo.absolute_url()) -elif method == 'deletePhoto' : - photo = uidtool.queryObject(fg('uid')) - if photo : - parent = photo.getParentNode() - parent.manage_delObjects([photo.getId()]) +elif method in ('deletePhoto', 'deletePortfolio') : + o = uidtool.queryObject(fg('uid')) + if o : + parent = o.getParentNode() + parent.manage_delObjects([o.getId()])