Exemplo n.º 1
0
 def _createRuleSetItem(self, freq):
     ruleItem = RecurrenceRule(None, view=self.rep.view)
     ruleItem.until = getattr(self, freq)['end']
     ruleItem.untilIsDate = False
     if freq == 'weekly':
         self.assertEqual(ruleItem.freq, 'weekly',
                          "freq should default to weekly")
     else:
         ruleItem.freq = freq
     ruleSetItem = RecurrenceRuleSet(None, view=self.rep.view)
     ruleSetItem.addRule(ruleItem)
     return ruleSetItem
Exemplo n.º 2
0
 def _createRuleSetItem(self, freq):
     ruleItem = RecurrenceRule(None, view=self.rep.view)
     ruleItem.until = getattr(self, freq)['end']
     ruleItem.untilIsDate = False
     if freq == 'weekly':
         self.assertEqual(ruleItem.freq, 'weekly', 
                          "freq should default to weekly")
     else:
         ruleItem.freq = freq
     ruleSetItem = RecurrenceRuleSet(None, view=self.rep.view)
     ruleSetItem.addRule(ruleItem)
     return ruleSetItem
Exemplo n.º 3
0
def addEventStamp(item, recur=False):
    es = EventStamp(item)
    es.add()
    es.summary = uw("Test Event Summary")

    tzinfo = item.itsView.tzinfo.floating

    # Choose random days, hours
    startDelta = timedelta(days=random.randint(0, 30),
                           hours=random.randint(0, 24))

    now = datetime.now(tzinfo)

    closeToNow = datetime(now.year,
                          now.month,
                          now.day,
                          now.hour,
                          int(now.minute / 30) * 30,
                          tzinfo=now.tzinfo)

    es.startTime = closeToNow + startDelta
    es.anyTime = True

    # Choose random minutes
    es.duration = timedelta(minutes=60)

    es.location = Calendar.Location.getLocation(view, uw("My House"))

    es.itsItem.importance = random.choice(pim.ImportanceEnum.values)

    es.itsItem.setTriageStatus(randomEnum(pim.TriageEnum))

    if recur:
        rule = RecurrenceRule(itsView=view)
        rule.freq = 'daily'
        rule.until = datetime(2008, 9, 14, 19, tzinfo=view.tzinfo.default)
        rule.untilIsDate = False

        ruleSet = RecurrenceRuleSet(itsView=view)
        ruleSet.addRule(rule)

        es.rruleset = ruleSet

    return es
Exemplo n.º 4
0
def addEventStamp(item, recur=False):
    es = EventStamp(item)
    es.add()
    es.summary = uw("Test Event Summary")

    tzinfo = view.tzinfo.floating

    # Choose random days, hours
    startDelta = timedelta(days=random.randint(0, 30),
                           hours=random.randint(0, 24))

    now = datetime.now(tzinfo)

    closeToNow = datetime(now.year, now.month, now.day, now.hour,
                          int(now.minute/30) * 30, tzinfo=now.tzinfo)

    es.startTime = closeToNow + startDelta
    es.anyTime = True

    # Choose random minutes
    es.duration = timedelta(minutes=60)

    es.location = Calendar.Location.getLocation(view, uw("My House"))

    es.itsItem.importance = random.choice(pim.ImportanceEnum.values)

    es.itsItem.setTriageStatus(randomEnum(pim.TriageEnum))

    if recur:
        rule = RecurrenceRule(itsView=view)
        rule.freq = 'daily'
        rule.until =  datetime(2008, 9, 14, 19, tzinfo=view.tzinfo.default)
        rule.untilIsDate = False

        ruleSet = RecurrenceRuleSet(itsView=view)
        ruleSet.addRule(rule)

        es.rruleset = ruleSet

    return es