- Timestamp:
- 14 Nov 2014, 22:32:42 (11 years ago)
- Location:
- main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/customers
- Files:
-
- 20 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/customers/interfaces.py
r11956 r11958 22 22 from zc.sourcefactory.contextual import BasicContextualSourceFactory 23 23 from waeup.ikoba.interfaces import MessageFactory as _ 24 from waeup.ikoba.interfaces import ( 25 IIkobaObject, application_sessions_vocab, validate_email, ICSVExporter) 24 26 from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber 25 from waeup.ikoba.interfaces import IIkobaObject 27 from waeup.ikoba.browser.interfaces import ICustomerNavigationBase 28 29 from waeup.ikoba.customers.vocabularies import ( 30 contextual_reg_num_source, GenderSource, nats_vocab) 26 31 27 32 class ICustomersUtils(Interface): … … 71 76 unique_customer_id = Attribute("""A unique customer id.""") 72 77 78 79 class ICustomerNavigation(ICustomerNavigationBase): 80 """Interface needed for custom navigation, logging, etc. 81 82 """ 83 customer = Attribute('Customer object of context.') 84 85 def writeLogMessage(view, message): 86 """Write a view specific log message into custom.log. 87 88 """ 89 73 90 class ICustomer(IIkobaObject): 74 91 """Representation of a customer. … … 76 93 """ 77 94 95 history = Attribute('Object history, a list of messages') 96 state = Attribute('Returns the registration state of a customer') 97 password = Attribute('Encrypted password of a customer') 98 temp_password = Attribute( 99 'Dictionary with user name, timestamp and encrypted password') 100 fullname = Attribute('All name parts separated by hyphens') 101 display_fullname = Attribute('The fullname of an applicant') 102 103 suspended = schema.Bool( 104 title = _(u'Account suspended'), 105 default = False, 106 required = False, 107 ) 108 109 suspended_comment = schema.Text( 110 title = _(u"Reasons for Deactivation"), 111 required = False, 112 description = _( 113 u'This message will be shown if and only if deactivated ' 114 'customers try to login.'), 115 ) 116 117 customer_id = schema.TextLine( 118 title = _(u'Student Id'), 119 required = False, 120 ) 121 122 firstname = schema.TextLine( 123 title = _(u'First Name'), 124 required = True, 125 ) 126 127 middlename = schema.TextLine( 128 title = _(u'Middle Name'), 129 required = False, 130 ) 131 132 lastname = schema.TextLine( 133 title = _(u'Last Name (Surname)'), 134 required = True, 135 ) 136 137 sex = schema.Choice( 138 title = _(u'Sex'), 139 source = GenderSource(), 140 required = True, 141 ) 142 143 reg_number = TextLineChoice( 144 title = _(u'Registration Number'), 145 required = True, 146 readonly = False, 147 source = contextual_reg_num_source, 148 ) 149 150 email = schema.ASCIILine( 151 title = _(u'Email'), 152 required = False, 153 constraint=validate_email, 154 ) 155 phone = PhoneNumber( 156 title = _(u'Phone'), 157 description = u'', 158 required = False, 159 ) 160 161 def setTempPassword(user, password): 162 """Set a temporary password (LDAP-compatible) SSHA encoded for 163 officers. 164 165 """ 166 167 def getTempPassword(): 168 """Check if a temporary password has been set and if it 169 is not expired. 170 171 Return the temporary password if valid, 172 None otherwise. Unset the temporary password if expired. 173 """ 174 175 class ICustomerUpdateByRegNo(ICustomer): 176 """Representation of a customer. Skip regular reg_number validation. 177 178 """ 179 reg_number = schema.TextLine( 180 title = _(u'Registration Number'), 181 required = False, 182 ) 183 184 class ICSVCustomerExporter(ICSVExporter): 185 """A regular ICSVExporter that additionally supports exporting 186 data from a given customer object. 187 """ 188 def get_filtered(site, **kw): 189 """Get a filtered set of customer. 190 """ 191 192 def export_student(student, filepath=None): 193 """Export data for a given customer. 194 """ 195 196 def export_filtered(site, filepath=None, **kw): 197 """Export filtered set of customers. 198 """ 199
Note: See TracChangeset for help on using the changeset viewer.