enyo 2.5 model.parse

edited December 2014 in General
So i am trying to update an app to 2.5, and have run into a change that may be a bug.

On enyo.Model, when you fetch, it doesn't seem to call the parse function ever, even with options: {parse: true}

Here is the code from enyo.Model:
fetched: function (opts, res, source) {
			var idx;
			
			if (this._waiting) {
				idx = this._waiting.findIndex(function (ln) {
					return (ln instanceof Source ? ln.name : ln) == source;
				});
				if (idx > -1) this._waiting.splice(idx, 1);
				if (!this._waiting.length) this._waiting = null;
			}
			
			// ensure we have an options hash and it knows it was just fetched
			opts = opts ? opts : {};
			opts.fetched = true;
			
			// note this will not add the DIRTY state because it was fetched but also note that it
			// will not clear the DIRTY flag if it was already DIRTY
			if (res) this.set(res, opts);
			
			// clear the FETCHING and NEW state (if it was NEW) we do not set it as dirty as this
			// action alone doesn't warrant a dirty flag that would need to be set in the set method
			if (!this._waiting) this.status = this.status & ~(STATES.FETCHING | STATES.NEW);
			
			// now look for an additional success callback
			if (opts && opts.success) opts.success(this, opts, res, source);
		},
set: function (path, is, opts) {
			if (!this.destroyed) {
				
				var attrs = this.attributes,
					options = this.options,
					changed,
					incoming,
					force,
					silent,
					key,
					value,
					commit,
					fetched;
				
				// the default case for this setter is accepting an object of key->value pairs
				// to apply to the model in which case the second parameter is the optional
				// configuration hash
				if (typeof path == 'object') {
					incoming = path;
					opts = opts || is;
				}
				
				// otherwise in order to have a single path here we flub it so it will keep on
				// going as expected
				else {
					incoming = {};
					incoming[path] = is;
				}
				
				// to maintain backward compatibility with the old setters that allowed the third
				// parameter to be a boolean to indicate whether or not to force notification of
				// change even if there was any
				if (opts === true) {
					force = true;
					opts = {};
				}
		
				opts = opts ? enyo.mixin({}, [options, opts]) : options;
				silent = opts.silent;
				force = force || opts.force;
				commit = opts.commit;
				fetched = opts.fetched;
		
				for (key in incoming) {
					value = incoming[key];
			
					if (value !== attrs[key] || force) {
						// to ensure we have an object to work with
						// note that we check inside this loop so we don't have to examine keys
						// later only the local variable changed
						changed = this.changed || (this.changed = {});
						changed[key] = attrs[key] = value;
					}
				}
		
				if (changed) {
					
					// we add dirty as a value of the status but clear the CLEAN bit if it
					// was set - this would allow it to be in the ERROR state and NEW and DIRTY
					if (!fetched) this.status = (this.status | STATES.DIRTY) & ~STATES.CLEAN;
					
					if (!silent) this.emit('change', changed, this);
				
					if (commit && !fetched) this.commit(opts);
					
					// reset value so subsequent changes won't be added to this change-set
					this.changed = null;
				}
			}
			
			return this;
		},
So no where in there it checks if the results need to be parsed.
Is this by design? or a bug?

Comments

Sign In or Register to comment.