Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SenderEmail(Storm):
- """Address object
- Verify if the class implements the interfaces:
- >>> from zope.interface.verify import verifyClass
- >>> verifyClass(ISenderEmail, SenderEmail)
- True
- Create a testing database:
- >>> import transaction
- >>> from voipeople.zsqlobject import create_testingdb
- >>> zstorm, store = create_testingdb('voipeople')
- >>> from voipeople.content import Account, Address, Department, FaxLine, List
- >>> account = Account(legal_name=u'Kynetix S.r.l.', vat_rate = 20, billing_type_id =1)
- >>> dummy = store.add(account)
- >>> transaction.get().commit()
- >>> address = Address(line1=u'DUMMY', city=u'DUMMY', state=u'DUMMY',
- ... zip_code=u'00000', country=u'DUMMY', account=account)
- >>> dummy = store.add(address)
- >>> transaction.get().commit()
- >>> list = List(description=u'Voipeople Gold')
- >>> dummy = store.add(list)
- >>> transaction.get().commit()
- >>> department = Department(description=u'DUMMY',
- ... account=account, address=address)
- >>> dummy = store.add(department)
- >>> transaction.get().commit()
- >>> faxline = FaxLine(username=u'marco', password=u'granata',
- ... fax_number_id=2,department=department,
- ... salelist=list, account=account,delivery_email=u'mr@voipeople.it')
- >>> dummy = store.add(faxline)
- >>> email = SenderEmail(email=u'marco@voipeople.it', faxline=faxline )
- >>> dummy = store.add(email)
- >>> transaction.get().commit()
- >>> from zope.interface.verify import verifyObject
- >>> verifyObject(ISenderEmail, email)
- True
- Verify data and relations:
- >>> email.faxline.username
- u'marco'
- >>> email.email
- u'marco@voipeople.it'
- Clean up the testing database:
- >>> zstorm.remove(store)
- """
- implements(ISenderEmail, IVoipeopleSecurity)
- __storm_table__ = 'sender_emails'
- __storm_items__ = ()
- def __get_name(self):
- return unicode(self.id)
- def __set_name(self, value):
- pass
- __name__ = property(__get_name, __set_name)
- def __get_parent(self):
- return self.faxline['senderemails']
- def __set_parent(self, value):
- pass
- __parent__ = property(__get_parent, __set_parent)
- id = SQL.Int(primary=True)
- email = SQL.Unicode()
- active = SQL.Bool()
- fax_line_id = SQL.Int()
- faxline = SQL.Reference(fax_line_id, 'FaxLine.id')
- @staticmethod
- def get_info():
- info = {
- 'search_field': FaxLine.email,
- 'interface': IFaxLine,
- 'fields': ('email', 'active')
- }
- return info
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement