Example #1
0
 def handleAdd(self, action):
     self.handleApply.func(self, action)
     if (self.view.added is None or self.data['relationship'] is None):
         # XXX: we don't handle errors for now
         return
     contacts = IContactable(removeSecurityProxy(self.context)).contacts
     contacts.on(self.request.util.today).relate(
         self.view.added,
         meaning=self.data['relationship'].active,
         code=self.data['relationship'].code,
     )
Example #2
0
 def handleAdd(self, action):
     self.handleApply.func(self, action)
     if (self.view.added is None or
         self.data['relationship'] is None):
         # XXX: we don't handle errors for now
         return
     contacts = IContactable(removeSecurityProxy(self.context)).contacts
     contacts.on(self.request.util.today).relate(
         self.view.added,
         meaning=self.data['relationship'].active,
         code=self.data['relationship'].code,
         )
Example #3
0
def setUpSchool(app):
    sy = ISchoolYearContainer(app)['2005'] = SchoolYear(
        '2005', date(2005, 1, 1), date(2005, 1, 30))

    term = sy['spring'] = Term('Spring', date(2005, 1, 1), date(2005, 1, 30))
    term.addWeekdays(0, 1, 2, 3, 4)

    pc = app['persons']
    teacher = pc['teacher'] = BasicPerson("teacher", "Mister", "T")
    s1 = pc['john'] = BasicPerson("john", "John", "Peterson")
    s2 = pc['pete'] = BasicPerson("pete", "Pete", "Johnson")

    contacts = IContactContainer(app)
    contact = Contact()
    contact.__name__ = 'pete_parent'
    contact.prefix = 'Ms.'
    contact.first_name = 'Susan'
    contact.middle_name = 'T.'
    contact.last_name = 'Johnson'
    contact.suffix = 'Jr.'
    contact.address_line_1 = '1 First St.'
    contact.address_line_2 = 'Apt. 1'
    contact.city = 'NY'
    contact.state = 'NY'
    contact.country = 'USA'
    contact.postal_code = '00000'
    contact.email = '*****@*****.**'
    contact.home_phone = '000-0000'
    contact.work_phone = '111-1111'
    contact.mobile_phone = '222-2222'
    contact.language = 'English'
    contacts['pete_parent'] = contact

    IContactable(s2).contacts.relate(contact, ACTIVE + PARENT, 'p')
    IContactable(s2).contacts.relate(IContact(teacher), ACTIVE + PARENT, 'p')

    d1 = IDemographics(s1)
    d1['ID'] = "112323"
    d1['ethnicity'] = u'Asian'
    d1['language'] = "English"
    d1['placeofbirth'] = "Humptington"
    d1['citizenship'] = "US"
    d2 = IDemographics(s2)
    d2['ID'] = "333655"
    d2['ethnicity'] = u'White'
    d2['language'] = "Brittish"
    d2['placeofbirth'] = "Providence"
    d2['citizenship'] = "UK"

    course = ICourseContainer(sy)['c1'] = Course("History")
Example #4
0
def get_relationship_title(person, contact):
    state = IContactable(person).contacts.state(contact)
    if state is None:
        return u''
    app_states = getAppContactStates()
    title = app_states.getTitle(state.today)
    return title or u''
Example #5
0
    def format_person_contacts(self, person, major_progress=()):
        contacts = IContactable(person).contacts
        rows = []
        for contact in contacts.all():
            row = []
            row.append(Text(person.username))
            target_person = IBasicPerson(contact.__parent__, None)
            if target_person is None:
                row.append(Text(contact.__name__))
            else:
                row.append(Text(target_person.username))

            state = contacts.state(contact)
            for x, (date, meaning, code) in enumerate(state):
                row.append(Date(date))
                row.append(Text(code))
            rows.append(row)
        return rows
Example #6
0
    def format_person_contacts(self, person, major_progress=()):
        contacts = IContactable(person).contacts
        rows = []
        for contact in contacts.all():
            row = []
            row.append(Text(person.username))
            target_person = IBasicPerson(contact.__parent__, None)
            if target_person is None:
                row.append(Text(contact.__name__))
            else:
                row.append(Text(target_person.username))

            state = contacts.state(contact)
            for x, (date, meaning, code) in enumerate(state):
                row.append(Date(date))
                row.append(Text(code))
            rows.append(row)
        return rows
Example #7
0
 def items(self):
     result = []
     for member in self.context.members:
         if self.has_address(IContact(member)):
             result.append(member)
         for contact in IContactable(member).contacts:
             if self.has_address(contact):
                 result.append(contact)
     return result
Example #8
0
 def getCollection(self):
     return IContactable(removeSecurityProxy(self.context)).contacts
Example #9
0
 def getRelationships(self):
     bound = IContactable(self.person)
     contacts = bound.contacts
     return [self.buildInfo(contact) for contact in contacts]
Example #10
0
 def getContacts(self):
     contacts = IContactable(removeSecurityProxy(self.person)).contacts
     return [self.buildInfo(contact) for contact in contacts]
Example #11
0
 def contactable(self):
     return IContactable(removeSecurityProxy(self.context))