As we mentioned in earlier chapters, the Common module and class are used to hold small bits of information used throughout the application. These primarily take the form of choices in forms, including drop-down select elements. They are also used to reduce duplicate definitions, as well as present a way of aggregating information when queries on properties are performed.
Another advantage of keeping such items in a common collection is to facilitate translation into other languages. Accordingly, here is the actual structure of the Common class:
# booksomeplace.entity.common
import os,sys
sys.path.append(os.path.realpath("../../../src"))
from booksomeplace.entity.base import Base
class Common(Base) :
fields = {
'key' : '',
'value' : []
}
The actual keys and values were defined earlier in this chapter when we discussed how to define document structures.