milesrichardson / ParsePy

A relatively up-to-date fork of ParsePy, the Python wrapper for the Parse.com API. Originally maintained by @dgrtwo
MIT License
516 stars 184 forks source link

Added Remove Field support on Object, including tests #115

Closed flplv closed 9 years ago

flplv commented 9 years ago

The parse REST API does support the __op Delete to clear a field data, In this pull request I added a method similar to increment, named remove, to remove a field from the row. Also added a test to test it.

It has been tested (using the tests.py) and it is working.

flplv commented 9 years ago

Before anyone asks:

What is the difference between setting None to the field and removing it?


  1. Setting None Example code: parseObject.field = None Results:
    • On the Parse.com dashboard, you will have a row on the ParseObject Class where the field column value is ""
    • Every time you pull the parseObject from the server, your object will have the field attribute set to None.
  2. Removing Field (Accordingly to the proposed patch) Example code: parseObject.remove('field') Results:
    • On the Parse.com dashboard, instead of showing "" as the column value, you will have "".
    • Every time you pull the parseObject from the server, your object will not have the field attribute, if you try parseObject.field it will raise an AttributeError exception.

Both ways are valid Parse and valid Python. It is user decision to have the attribute removed from the object or have None as its value.