except Message.DoesNotExist:
        message = Message(id=o.announcement_id)

    message.time = datetime.datetime.combine(
        o.announced_date,
        datetime.time(*(int(x) for x in o.announced_time.split(":"))))

    try:
        x = o.announced_by
    except PersonOrOrgInfo.DoesNotExist:
        message.by = system
    else:
        if not o.announced_by.first_name and o.announced_by.last_name == 'None':
            message.by = system
        else:
            message.by = old_person_to_person(o.announced_by)

    message.subject = o.subject.strip()
    if o.announced_from_id == 99:
        message.frm = o.other_val or ""
    elif o.announced_from_id == 18 and o.nomcom_chair_id != 0:
        message.frm = u"%s <%s>" % o.nomcom_chair.person.email()
    else:
        if '<' in o.announced_from.announced_from:
            message.frm = o.announced_from.announced_from
        else:
            message.frm = u"%s <%s>" % (o.announced_from.announced_from,
                                        o.announced_from.email)
    if o.announced_to_id == 99:
        message.to = o.other_val or ""
    else:
Example #2
0
        message = Message.objects.get(id=o.announcement_id)
    except Message.DoesNotExist:
        message = Message(id=o.announcement_id)

    message.time = datetime.datetime.combine(o.announced_date,
                                             datetime.time(*(int(x) for x in o.announced_time.split(":"))))

    try:
        x = o.announced_by
    except PersonOrOrgInfo.DoesNotExist:
        message.by = system
    else:
        if not o.announced_by.first_name and o.announced_by.last_name == 'None':
            message.by = system
        else:
            message.by = old_person_to_person(o.announced_by)

    message.subject = o.subject.strip()
    if o.announced_from_id == 99:
        message.frm = o.other_val or ""
    elif o.announced_from_id == 18 and o.nomcom_chair_id != 0:
        message.frm = u"%s <%s>" % o.nomcom_chair.person.email()
    else:
        if '<' in o.announced_from.announced_from:
            message.frm = o.announced_from.announced_from
        else:
            message.frm = u"%s <%s>" % (o.announced_from.announced_from, o.announced_from.email)
    if o.announced_to_id == 99:
        message.to = o.other_val or ""
    else:
        try:
Example #3
0
        # some BOFs aren't WG-forming but we currently classify all as WGs
        group.type = type_names["wg"]

    if o.area:
        group.parent = Group.objects.get(acronym=o.area.area.area_acronym.acronym)
    elif not group.parent:
        print "no area/parent for", group.acronym, group.name, group.type, group.state

    try:
        area_director = o.area_director
    except AreaDirector.DoesNotExist:
        area_director = None
    if area_director and not area_director.area_id:
        area_director = None # fake TBD guy
        
    group.ad = old_person_to_person(area_director.person) if area_director else None
    group.list_email = o.email_address if o.email_address else ""
    group.list_subscribe = (o.email_subscribe or "").replace("//listinfo", "/listinfo").strip()
    l = o.clean_email_archive().strip() if o.email_archive else ""
    if l in ("none", "not available"):
        l = ""
    group.list_archive = l

    group.comments = o.comments.strip() if o.comments else ""
    
    group.save()

    for u in o.additional_urls():
        url, _ = GroupURL.objects.get_or_create(group=group, url=u.url)
        url.name = u.description.strip()
        url.save()
Example #4
0
    def import_material_kind(kind, doctype):
        # import agendas
        found = kind.objects.filter(meeting_num=m.pk,
                                    group_acronym_id=interim_meeting.group_acronym_id,
                                    irtf=1 if session.group.parent.acronym == "irtf" else 0,
                                    interim=1).using(database)

        for o in found:
            name = "%s-%s" % (doctype.slug, m.number)
            if kind == InterimSlides:
                name += "-%s" % o.slide_num

            name = name.lower()

            try:
                d = Document.objects.get(type=doctype, docalias__name=name)
            except Document.DoesNotExist:
                d = Document(type=doctype, name=name)
                
            if kind == InterimSlides:
                d.title = o.slide_name.strip()
                l = o.file_loc()
                d.external_url = l[l.find("slides/") + len("slides/"):]
                d.order = o.order_num or 1
            else:
                session_name = session.name if session.name else session.group.acronym.upper()
                d.title = u"%s for %s at %s" % (doctype.name, session_name, session.meeting)
                d.external_url = o.filename # save filenames for now as they don't appear to be quite regular
            d.rev = "00"
            d.group = session.group
            d.time = datetime.datetime.combine(meeting.date, datetime.time(0, 0, 0)) # we may have better estimate below

            d.save()

            d.set_state(State.objects.get(type=doctype, slug="active"))
                
            DocAlias.objects.get_or_create(document=d, name=name)

            session.materials.add(d)

            # try to create a doc event to figure out who uploaded it
            e = make_revision_event(d, system_person)

            t = d.type_id
            if d.type_id == "slides":
                t = "slide, '%s" % d.title
            activities = InterimActivities.objects.filter(group_acronym_id=interim_meeting.group_acronym_id,
                                                          meeting_num=interim_meeting.meeting_num,
                                                          activity__startswith=t,
                                                          activity__endswith="was uploaded").using(database)[:1]

            if activities:
                a = activities[0]

                e.time = datetime.datetime.combine(a.act_date, a.act_time)
                try:
                    e.by = old_person_to_person(PersonOrOrgInfo.objects.get(pk=a.act_by)) or system_person
                except PersonOrOrgInfo.DoesNotExist:
                    pass

                d.time = e.time
                d.save()
            else:
                print "NO UPLOAD ACTIVITY RECORD for", d.name.encode("utf-8"), t.encode("utf-8"), interim_meeting.group_acronym_id, interim_meeting.meeting_num

            e.save()
Example #5
0
    def import_material_kind(kind, doctype):
        # import agendas
        irtf = 0
        if wg_meeting_session.irtf:
            irtf = wg_meeting_session.group_acronym_id
        found = kind.objects.filter(
            meeting=wg_meeting_session.meeting_id,
            group_acronym_id=wg_meeting_session.group_acronym_id,
            irtf=irtf,
            interim=0)

        for o in found:
            name = "%s-%s-%s" % (doctype.slug, session.meeting.number,
                                 session.group.acronym)
            if kind == Slide:
                name += "-%s" % o.slide_num

            if session.name:
                name += "-%s" % slugify(session.name)

            name = name.lower()

            try:
                d = Document.objects.get(type=doctype, docalias__name=name)
            except Document.DoesNotExist:
                d = Document(type=doctype, name=name)

            if kind == Slide:
                d.title = o.slide_name.strip()
                l = o.file_loc()
                d.external_url = l[l.find("slides/") + len("slides/"):]
                d.order = o.order_num or 1
            else:
                session_name = session.name if session.name else session.group.acronym.upper(
                )
                d.title = u"%s for %s at %s" % (doctype.name, session_name,
                                                session.meeting)
                d.external_url = o.filename  # save filenames for now as they don't appear to be quite regular
            d.rev = "00"
            d.group = session.group
            d.time = datetime.datetime.combine(
                session.meeting.date,
                datetime.time(0, 0, 0))  # we may have better estimate below
            d.save()

            d.set_state(State.objects.get(type=doctype, slug="active"))

            DocAlias.objects.get_or_create(document=d, name=name)

            session.materials.add(d)

            # try to create a doc event to figure out who uploaded it
            e = make_revision_event(d, system_person)

            t = d.type_id
            if d.type_id == "slides":
                t = "slide, '%s" % d.title
            activities = WgProceedingsActivities.objects.filter(
                group_acronym=wg_meeting_session.group_acronym_id,
                meeting=wg_meeting_session.meeting_id,
                activity__startswith=t,
                activity__endswith="was uploaded")[:1]
            if activities:
                a = activities[0]

                e.time = datetime.datetime.combine(
                    a.act_date,
                    datetime.time(*[int(s) for s in a.act_time.split(":")]))
                try:
                    e.by = old_person_to_person(a.act_by) or system_person
                except PersonOrOrgInfo.DoesNotExist:
                    pass

                d.time = e.time
                d.save()
            else:
                print "NO UPLOAD ACTIVITY RECORD for", d.name.encode(
                    "utf-8"
                ), t.encode(
                    "utf-8"
                ), wg_meeting_session.group_acronym_id, wg_meeting_session.meeting_id

            e.save()
Example #6
0
                s.name = acronym.name

                if timeslot:
                    if timeslot.name == "Unknown":
                        timeslot.name = acronym.name

                    if "Plenary" in timeslot.name:
                        timeslot.type = plenary_slot
                    else:
                        timeslot.type = other_slot
            else:
                s.group = Group.objects.get(acronym=acronym.acronym)
        s.attendees = o.number_attendee
        s.agenda_note = (o.special_agenda_note or "").strip()
        s.requested = o.requested_date or obviously_bogus_date
        s.requested_by = old_person_to_person(
            o.requested_by) if o.requested_by else system_person
        s.requested_duration = requested_length_mapping[getattr(
            o, "length_session%s" % i)]
        s.comments = (o.special_req or "").strip()
        conflict_other = (o.conflict_other or "").strip()
        if conflict_other:
            if s.comments:
                s.comments += " "
            s.comments += u"(other conflicts: %s)" % conflict_other
        s.status = session_status_mapping[o.status_id or 5]

        s.scheduled = o.scheduled_date
        s.modified = o.last_modified_date or obviously_bogus_date

        s.save()
Example #7
0
    def lookup_group(**kwargs):
        try:
            return Group.objects.get(**kwargs)
        except Group.DoesNotExist:
            return None

    l.from_name = o.from_body().strip()
    l.from_group = get_body(l.from_name, o.from_raw_code) # try to establish link
    if not o.person:
        l.from_contact = None
    else:
        try:
            l.from_contact = Email.objects.get(address__iexact=o.from_email().address)
        except EmailAddress.DoesNotExist:
            l.from_contact = old_person_to_person(o.person).email_set.order_by('-active')[0]

    if o.by_secretariat:
        l.to_name = o.submitter_name
        if o.submitter_email:
            l.to_name += " <%s>" % o.submitter_email
    else:
        l.to_name = o.to_body
    l.to_name = l.to_name.strip()
    l.to_group = get_body(l.to_name, o.to_raw_code) # try to establish link
    l.to_contact = (o.to_poc or "").strip()

    l.reply_to = (o.replyto or "").strip()

    l.response_contact = (o.response_contact or "").strip()
    l.technical_contact = (o.technical_contact or "").strip()
Example #8
0
                s.name = acronym.name

                if timeslot:
                    if timeslot.name == "Unknown":
                        timeslot.name = acronym.name

                    if "Plenary" in timeslot.name:
                        timeslot.type = plenary_slot
                    else:
                        timeslot.type = other_slot
            else:
                s.group = Group.objects.get(acronym=acronym.acronym)
        s.attendees = o.number_attendee
        s.agenda_note = (o.special_agenda_note or "").strip()
        s.requested = o.requested_date or obviously_bogus_date
        s.requested_by = old_person_to_person(o.requested_by) if o.requested_by else system_person
        s.requested_duration = requested_length_mapping[getattr(o, "length_session%s" % i)]
        s.comments = (o.special_req or "").strip()
        conflict_other = (o.conflict_other or "").strip()
        if conflict_other:
            if s.comments:
                s.comments += " "
            s.comments += u"(other conflicts: %s)" % conflict_other
        s.status = session_status_mapping[o.status_id or 5]

        s.scheduled = o.scheduled_date
        s.modified = o.last_modified_date or obviously_bogus_date

        s.save()

        if timeslot:
Example #9
0
        group.type = type_names["wg"]

    if o.area:
        group.parent = Group.objects.get(
            acronym=o.area.area.area_acronym.acronym)
    elif not group.parent:
        print "no area/parent for", group.acronym, group.name, group.type, group.state

    try:
        area_director = o.area_director
    except AreaDirector.DoesNotExist:
        area_director = None
    if area_director and not area_director.area_id:
        area_director = None  # fake TBD guy

    group.ad = old_person_to_person(
        area_director.person) if area_director else None
    group.list_email = o.email_address if o.email_address else ""
    group.list_subscribe = (o.email_subscribe
                            or "").replace("//listinfo", "/listinfo").strip()
    l = o.clean_email_archive().strip() if o.email_archive else ""
    if l in ("none", "not available"):
        l = ""
    group.list_archive = l

    group.comments = o.comments.strip() if o.comments else ""

    group.save()

    for u in o.additional_urls():
        url, _ = GroupURL.objects.get_or_create(group=group, url=u.url)
        url.name = u.description.strip()