Skip to content

BaseField instantiate=True seems to fail #36

Description

@djmoreho

Creating a instance of a field will make it look like it fails because BaseField prints None, however it doesn't (I just spent a while seeing why it was 'failing').

Script that demonstrates the 'fail'

from suitcase.fields import UBInt8

# create our placeholder
u = UBInt8(instantiate=False)
print u # correct result

# create our actual object
u = UBInt8(instantiate=True)
print u # doesn't return a instance..... or does it

Fix would be simply changing the BaseField repr to,

def __repr__(self):
    return "Field(_value="+repr(self.getval())+")"

and we get a much better result that doesn't seem to fail, though having just the normal repr would give better information (i.e what field).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions