示例#1
0
 def fill_data(self):
     '''
     Fills in dummy content that we will use for testing
     2 members, Peter and Hans.
     2 workgroups, Systems and Besteling.
     Peter is the only member in Systems.
     Both are members in Bestel, with Hans leading that one.
     Bestel has a shift ('do stuff') for Peter.
     '''
     m1 = Member(fname=u'Peter', prefix=u'de', lname='Pan')
     m1.mem_email = '*****@*****.**'
     m1.mem_enc_pwd = md5_crypt.hash('notsecret')
     self.DBSession.add(m1)
     m2 = Member(fname=u'Hans', prefix=u'de', lname='Wit')
     m1.mem_email = '*****@*****.**'
     self.DBSession.add(m2)
     wg1 = Workgroup(name=u'Systems', desc=u'IT stuff')
     self.DBSession.add(wg1)
     wg2 = Workgroup(name=u'Besteling', desc=u'Besteling at wholesale')
     self.DBSession.add(wg2)
     self.DBSession.flush()  # flush now to get member and workgroup IDs
     wg1.members.append(m1)
     wg1.leaders.append(m1)
     wg2.members.append(m1)
     wg2.members.append(m2)
     wg2.leaders.append(m2)
     self.DBSession.flush()
     s = Shift(wg2.id, 'do stuff', 2012, 6, member=m1)
     self.DBSession.add(s)
     self.DBSession.flush()
     # reserved transaction types
     for rt in reserved_ttype_names:
         self.DBSession.add(TransactionType(name=rt))
     self.DBSession.flush()
示例#2
0
def addOldNames():
    m1 = Member(fname=u'Peter', prefix=u'de', lname='Pan')
    m1.mem_email = '*****@*****.**'
    m1.mem_enc_pwd = md5crypt('notsecret', 'notsecret')
    DBSession.add(m1)
    m2 = Member(fname=u'Hans', prefix=u'de', lname='Wit')
    m1.mem_email = '*****@*****.**'
    DBSession.add(m2)
    wg1 = Workgroup(name=u'Systems', desc=u'IT stuff')
    DBSession.add(wg1)
    wg2 = Workgroup(name=u'Besteling', desc=u'Besteling at wholesale')
    DBSession.add(wg2)
    DBSession.flush()  # flush now to get member and workgroup IDs
    wg1.members.append(m1)
    wg1.leaders.append(m1)
    wg2.members.append(m1)
    wg2.members.append(m2)
    wg2.leaders.append(m2)
    DBSession.flush()
    s = Shift(wg2.id, 'do stuff', 2012, 6, member=m1)
    DBSession.add(s)
    DBSession.flush()
示例#3
0
def addAdmin():
    '''
    after old names are added, he has ID 3
    '''
    admin = Member(fname=u'Adalbert', lname='Adminovic')
    admin.mem_email = '*****@*****.**'
    admin.mem_mobile = "06" + unicode(random.randint(10000000, 100000000))
    admin.household_size = 1
    salt = md5crypt('notsecret', '')
    admin.mem_enc_pwd = md5crypt('notsecret', salt)
    admin.mem_admin = True
    admin.mem_active = True
    DBSession.add(admin)
    DBSession.flush()
    wgs = DBSession.query(Workgroup).filter(
        Workgroup.name == u'Systems').first()
    wgs.members.append(admin)
    wgm = DBSession.query(Workgroup).filter(
        Workgroup.name == u'Membership').first()
    wgm.members.append(admin)
示例#4
0
 def __call__(self):
     session = DBSession()
     a_id = self.request.matchdict['a_id']
     applicant = get_applicant(session, a_id)
     # copy over our knowledge of him/her
     member = Member(self.request, applicant.fname, '', applicant.lname)
     now = datetime.now()
     txt = "Joined orientation in {}, became member in {}/{}.".format(\
             applicant.month, now.month, now.year)
     member.mem_adm_comment = "{}\n{}".format(txt, applicant.comment)
     member.mem_email = applicant.email
     member.mem_home_tel = applicant.telnr
     member.mem_household_size = applicant.household_size
     member.validate()
     session.add(member)
     session.delete(applicant)
     session.flush()
     send_pwdreset_request(member, self.request.application_url, first=True)
     return self.redirect("/member/{}?msg=Applicant has been made "\
                         "into a new Member and got an email to set up a "\
                         "password."\
                         .format(member.mem_id))