Issue 1343 - Ensure equals method works properly with all Fields #1351

Closed
wants to merge 1 commit into
from

3 participants

@eltimn
Lift Web Framework member

Since Field.setBox now compares values before setting the dirty flag I wanted to make sure all of the fields' values have proper equals methods.

There were 2 that had problems; PatternField and BsonRecordField. I didn't figure out a solution for Pattern, but for BsonRecord I added an equals method to Record that compares each field.

There is also a problem with BsonRecord relating to it's mutablity. See this thread [1] for more info.

To help alleviate the problem I did 2 things:

  • Added a copy method to Record that creates a new Record instance with all fields set to the values in the original instance
  • Added forceDirty_? to Field. Setting this to true will force the dirty flag to always be set when calling setBox, the same as the previous behavior.

Note that this commit includes @davewhittaker 's fix for issue 1335

1 - https://groups.google.com/d/topic/liftweb/g8SwfKsLW_0/discussion

@lkuczera
Lift Web Framework member

+1 I like the copy function although sometimes you don't carbon copy all fields. I'd add a test function that takes field as argument and returns boolean. This way we could filter out which fields should be copied. Thoughts ?

@eltimn
Lift Web Framework member

Sounds like a good idea.

@fmpwizard
Lift Web Framework member

so, do we wait before rebasing this one into master?

@eltimn
Lift Web Framework member

Yes. I'll add that feature to it first.

@eltimn
Lift Web Framework member

On second thought, I created a new issue (#1354) for the filter function. I will work on it when I have more time.

This has been merged to master as is.

@eltimn eltimn closed this Nov 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment