Changeset 365d679 in pycorepos
- Timestamp:
- 07/21/2020 03:07:28 PM (3 years ago)
- Branches:
- master
- Children:
- 4c7b208
- Parents:
- 13b8380
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
corepos/db/office_op/model.py
r13b8380 r365d679 25 25 """ 26 26 27 import logging 28 27 29 import sqlalchemy as sa 28 30 from sqlalchemy import orm … … 30 32 from sqlalchemy.ext.associationproxy import association_proxy 31 33 34 35 log = logging.getLogger(__name__) 32 36 33 37 Base = declarative_base() … … 1057 1061 return self.full_name 1058 1062 1063 def split_street(self): 1064 """ 1065 Tries to split the :attr:`street` attribute into 2 separate lines, e.g. 1066 "street1" and "street2" style. Always returns a 2-tuple even if the 1067 second line would be empty. 1068 """ 1069 address = (self.street or '').strip() 1070 lines = address.split('\n') 1071 street1 = lines[0].strip() or None 1072 street2 = None 1073 if len(lines) > 1: 1074 street2 = lines[1].strip() or None 1075 if len(lines) > 2: 1076 log.warning("member #%s has %s address lines: %s", 1077 self.card_number, len(lines), self) 1078 return (street1, street2) 1079 1059 1080 1060 1081 class MemberDate(Base):
Note: See TracChangeset
for help on using the changeset viewer.