Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FaxLine(StormContainer):
- """FaxLine object
- Verify if the class implements the interfaces:
- >>> from zope.interface.verify import verifyClass
- >>> verifyClass(IFaxLine, FaxLine)
- True
- Create a testing database:
- >>> import transaction
- >>> from voipeople.zsqlobject import create_testingdb
- >>> zstorm, store = create_testingdb('voipeople')
- Verify that the object implements the interfaces:
- >>> 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(password=u'granata', security = 1,
- ... fax_number_id=2,department=department,
- ... salelist=list, account=account, delivery_email=u'mr@voipeople.it',username=u'marco')
- >>> dummy = store.add(faxline)
- >>> transaction.get().commit()
- >>> from zope.interface.verify import verifyObject
- >>> verifyObject(IFaxLine, faxline)
- True
- Verify data and relations:
- >>> faxline.username
- u'marco'
- >>> faxline.department.description
- u'DUMMY'
- >>> faxline.department.account.legal_name
- u'Kynetix S.r.l.'
- Clean up the testing database:
- >>> zstorm.remove(store)
- """
- implements(IFaxLine, IVoipeopleSecurity)
- __storm_table__ = 'fax_lines'
- __storm_items__ = ('senderemails', 'faxdetailrecords')
- def __get_name(self):
- return unicode(self.id)
- def __set_name(self, value):
- pass
- __name__ = property(__get_name, __set_name)
- def __get_parent(self):
- app = getSite()
- if IVoipeopleApplication.providedBy(app):
- return app['faxlines']
- return None
- def __set_parent(self, value):
- pass
- __parent__ = property(__get_parent, __set_parent)
- id = SQL.Int(primary=True)
- username = SQL.Unicode()
- password = SQL.Unicode()
- delivery_email = SQL.Unicode()
- delivery_name = SQL.Unicode()
- sent_fax = SQL.Int()
- security = SQL.Bool()
- fax_number_id = SQL.Int()
- faxnumber = SQL.Reference(fax_number_id, 'FaxNumber.id')
- status = SQL.Unicode(default=u'N')
- faxdetailrecords = SQL.ReferenceSet(id, "FaxDetailRecord.fax_line_id")
- senderemails = SQL.ReferenceSet(id, "SenderEmail.fax_line_id")
- #serviceslines = SQL.ReferenceSet(id, "ServiceLine.fax_line_id")
- #flatratestatus = SQL.ReferenceSet(id, "SenderEmail.fax_line_id")
- department_id = SQL.Int()
- department = SQL.Reference(department_id, 'Department.id')
- sale_list_id = SQL.Int()
- salelist = SQL.Reference(sale_list_id, 'List.id')
- account_id = SQL.Int()
- account = SQL.Reference(account_id, 'Account.id')
- @staticmethod
- def get_info():
- info = {
- 'search_field': FaxLine.username,
- 'interface': IFaxLine,
- 'fields': ('username', 'password', 'faxnumber', 'status','delivery_email', 'delivery_name', 'department', 'salelist')
- }
- return info
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement