Code Monkey home page Code Monkey logo

Comments (4)

vangheem avatar vangheem commented on July 4, 2024

initial implementation in 4.1.4

from guillotina.

ebrehault avatar ebrehault commented on July 4, 2024

Hi @vangheem, thank you for that.

I have a question though:

I have a folder with IAttachment behavior:

{"@id": "http://127.0.0.1:8080/db/c1/folder5", "@type": "Folder", "@name": "folder5", "@uid": "fe3|e589a5c8ff984ca8899deb8dd79a443d", "parent": {"@id": "http://127.0.0.1:8080/db/c1", "@name": "c1", "@type": "Container", "@uid": "fe3b0df173a14b4691fd93e692202c4a", "UID": "fe3b0df173a14b4691fd93e692202c4a"}, "is_folderish": true, "creation_date": "2018-08-30T19:37:53.071538+00:00", "modification_date": "2018-08-30T20:16:31.207804+00:00", "UID": "fe3|e589a5c8ff984ca8899deb8dd79a443d", "type_name": "Folder", "title": "Folder tt", "uuid": "fe3|e589a5c8ff984ca8899deb8dd79a443d", "__behaviors__": ["guillotina.behaviors.attachment.IAttachment"], "__name__": "folder5", "guillotina.behaviors.dublincore.IDublinCore": {"title": "Folder tt", "description": null, "creation_date": "2018-08-30T19:37:53.071538+00:00", "modification_date": "2018-08-30T20:16:31.207804+00:00", "effective_date": null, "expiration_date": null, "creators": [], "tags": null, "publisher": null, "contributors": ["root"]}, "guillotina.behaviors.attachment.IAttachment": {"file": null}, "items": [], "length": 0}

then I do a PUT where I remove the guillotina.behaviors.attachment.IAttachment attribute and I update the __behaviors__ value accordingly:

curl 'http://127.0.0.1:8080/db/c1/folder5' -X PUT -H 'Accept: application/json' -H 'Referer: http://localhost:4200/db/c1/folder5/@@edit' -H 'Origin: http://localhost:4200' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36' -H 'Authorization: Basic cm9vdDpyb290' -H 'Content-Type: application/json' --data-binary '{"@id":"http://127.0.0.1:8080/db/c1/folder5","@type":"Folder","@name":"folder5","@uid":"fe3|e589a5c8ff984ca8899deb8dd79a443d","parent":{"@id":"http://127.0.0.1:8080/db/c1","@name":"c1","@type":"Container","@uid":"fe3b0df173a14b4691fd93e692202c4a","UID":"fe3b0df173a14b4691fd93e692202c4a"},"is_folderish":true,"creation_date":"2018-08-30T19:37:53.071538+00:00","modification_date":"2018-08-30T20:16:31.207804+00:00","UID":"fe3|e589a5c8ff984ca8899deb8dd79a443d","type_name":"Folder","title":"Folder tt","uuid":"fe3|e589a5c8ff984ca8899deb8dd79a443d","__behaviors__":[],"__name__":"folder5","guillotina.behaviors.dublincore.IDublinCore":{"title":"Folder tt","description":null,"creation_date":"2018-08-30T19:37:53.071538+00:00","modification_date":"2018-08-30T20:16:31.207804+00:00","effective_date":null,"expiration_date":null,"creators":[],"tags":null,"publisher":null,"contributors":["root"]},"items":[],"length":0}' --compressed

I get a proper 204 response, but the behavior is still there.

Is it expected?

If I update a value like the IDublinCore title, the change is properly saved, so I guess it is more a problem about updating behaviors manually.

It would be nice if it was possible, but if removing behaviors with a direct PUT on the resource is too difficult technically, maybe we should get an error status when trying to, instead of a 204.

from guillotina.

vangheem avatar vangheem commented on July 4, 2024

Thanks Eric. I'll look into it--it's not too technically difficult. I'm just missing this part. Thanks for testing!

from guillotina.

ebrehault avatar ebrehault commented on July 4, 2024

Fixed by #335

from guillotina.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.