Burgerlib Python
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
burger.validators.NoneProperty Class Reference

Class to enforce None in member variable. More...

Public Member Functions

def __init__ (self, name)
 Initialize to default. More...
 
def __get__ (self, instance, owner=None)
 Return None. More...
 
def __set__ (self, instance, value)
 Throw if not None. More...
 

Private Attributes

 _name
 The real name of the class instance.
 

Detailed Description

Class to enforce None in member variable.

Examples

"Inherit from (object) for Python 2.7"
>>> class foo(object):
"Init to None"
x = NoneProperty()
"Create the class"
f = foo()
"Print None"
print(f.x)
"Exception on non None data"
f.x = "not None"
Traceback (most recent call last):
...
ValueError: Not None value

Constructor & Destructor Documentation

◆ __init__()

def burger.validators.NoneProperty.__init__ (   self,
  name 
)

Initialize to default.

Parameters
nameName of the instance storage index

Member Function Documentation

◆ __get__()

def burger.validators.NoneProperty.__get__ (   self,
  instance,
  owner = None 
)

Return None.

Parameters
instanceReference to object containing data
ownerNot used
Returns
None, or verified data

◆ __set__()

def burger.validators.NoneProperty.__set__ (   self,
  instance,
  value 
)

Throw if not None.

Parameters
instanceReference to object containing data
valueNone or value the can be converted to bool