Changeset 1611
- Timestamp:
- 20 Mar 2007, 18:26:23 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r1602 r1611 762 762 if not old_first and not old_middle and old_last: 763 763 new_names = [n.capitalize() for n in old_last.split()] 764 if len(new_names) > 3:764 if len(new_names) > 1: 765 765 old_first = new_names[0] 766 old_last = new_names[1] 767 old_middle = ' '.join(new_names[2:]) 768 elif len(new_names) == 3: 769 old_first = new_names[0] 770 old_last = new_names[1] 771 old_middle = new_names[2] 772 elif len(new_names) == 2: 773 old_first = new_names[0] 774 old_last = new_names[1] 775 old_middle = '' 776 elif len(new_names) == 1: 766 old_last = new_names[-1] 767 old_middle = ' '.join(new_names[1:-1]) 768 else: 777 769 old_last = new_names[0] 778 770 old_first = '' 779 771 old_middle = '' 780 if old_ last:781 new_first = old_ last772 if old_first: 773 new_first = old_first 782 774 if old_middle: 783 775 new_middle = old_middle 784 if old_first: 785 new_last = old_first 786 776 if old_last: 777 new_last = old_last 787 778 if old_first.find('<') != -1 or\ 788 779 old_first.find('>') != -1 or\ … … 793 784 invalid = "invalid characters" 794 785 else: 795 if old_first and old_middle and old_last: 796 new_first = old_first.capitalize() 797 new_middle = old_middle.capitalize() 798 new_last = old_last.capitalize() 799 elif old_first and not old_middle and old_last: 800 new_names = [n.capitalize() for n in old_first.split()] 801 if len(new_names) > 1: 802 new_first = new_names[0] 803 new_middle = ' '.join(new_names[1:]) 804 else: 805 new_first = old_first.capitalize() 806 new_middle = '' 807 new_last = old_last.capitalize() 808 elif not old_first and not old_middle and old_last: 786 new_first = old_first 787 if new_first.strip() == '-': 809 788 new_first = '' 789 new_middle = old_middle 790 if new_middle.strip() == '-': 810 791 new_middle = '' 811 new_last = old_last.capitalize() 812 else: 813 new_first = '' 814 new_middle = '' 792 new_last = old_last 793 if new_last.strip() == '-': 815 794 new_last = '' 816 name = "%(new_ last)s %(new_first)s %(new_middle)s" % vars()795 name = "%(new_first)s %(new_middle)s %(new_last)s" % vars() 817 796 if new_student: 818 797 text = "New"
Note: See TracChangeset for help on using the changeset viewer.