[#8] Update how state is handled for source objects

This commit is contained in:
amercader 2013-03-12 15:35:49 +00:00
parent 2ee3f33f51
commit 5e50a5c9ad
1 changed files with 3 additions and 7 deletions

View File

@ -163,7 +163,6 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm):
'state', 'owner_org', 'frequency', 'config', 'state', 'owner_org', 'frequency', 'config',
'organization'] 'organization']
#TODO: state and delete
if not schema: if not schema:
schema = self.form_to_db_schema() schema = self.form_to_db_schema()
schema_keys = schema.keys() schema_keys = schema.keys()
@ -299,9 +298,7 @@ def _create_harvest_source_object(data_dict):
if o in data_dict and data_dict[o] is not None: if o in data_dict and data_dict[o] is not None:
source.__setattr__(o,data_dict[o]) source.__setattr__(o,data_dict[o])
#TODO: state / deleted source.active = data_dict.get('state', None) == 'active'
if 'active' in data_dict:
source.active = data_dict['active']
# Don't commit yet, let package_create do it # Don't commit yet, let package_create do it
source.add() source.add()
@ -343,12 +340,11 @@ def _update_harvest_source_object(data_dict):
if 'source_type' in data_dict: if 'source_type' in data_dict:
source.type = data_dict['source_type'] source.type = data_dict['source_type']
if 'active' in data_dict:
source.active = data_dict['active']
if 'config' in data_dict: if 'config' in data_dict:
source.config = data_dict['config'] source.config = data_dict['config']
source.active = data_dict.get('state', None) == 'active'
# Don't commit yet, let package_create do it # Don't commit yet, let package_create do it
source.add() source.add()