CartoDB/cartoframes

Deleting publications in CARTOframes

Opened this issue · 4 comments

The way publications are deleted now is incomplete and not very useful. When a map is published, you can use the instance of the map to call delete_publication and it removed the latest publication of the map. However, if you publish the same map instance twice with different names, the first publication is lost and map.delete_publication() removes the second one which is the latest, but not the first.

There is also a static method Map.all_publications to get all the publications, which provides a dict containing the id, url, name, and privacy of the publications. But you can not use this since there is no static method Map.delete_publication(name).

Proposal

My proposal is to remove the instance method delete_publication() and add a Map.delete_publication(name) method. This can be done changing only CF. I have implemented a PoC in this branch: delete-publications.

>>> Map.all_publications(my_creds)
[{...'name': 'map_name',...}...]

>>> Map.delete_publication('map_name', my_creds)
Success! Publication "map_name" deleted

>>> Map.delete_publication('map_name', my_creds)
PublishError: Publication "map_name" not found.

cc @cmongut @oleurud @alasarr

delete_publication and all_publications methods don't work as instance methods but neither as static ones of the Map class as it shouldn't have that responsibility. A better option could be to create functions at some level or create a service for publishing.

Said that, with the solution we have already provided, we are giving the user the value we wanted so I would go with this approach.

OK, perfect. I agree with adding the methods in viz. We will add this improvement after the 1.0.0 release.