Software Freedom Law Center

Changeset 157

Show
Ignore:
Timestamp:
06/18/08 14:22:20 (4 months ago)
Author:
landon
Message:

There is now very basic time parsing, actual interpretation of the data still needs to be done

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/antimatter/luke/myplugs/libtracker/auth.py

    r156 r157  
    2727    if (not user == None): 
    2828        until = gmtime(config.get('max_auth') - (time() - user.lastauth)) 
     29        bot.say(ievent.nick,repr(config.get('max_auth'))) 
    2930        bot.say(ievent.nick, "You're still authenticated for " + str(until[3]) + "h:" \ 
    3031        + str(until[4]) + "m:" + str(until[5]) + "s") 
  • trunk/antimatter/luke/myplugs/libtracker/timeparser.py

    r155 r157  
     1"""The time parsing utilities""" 
     2 
    13from datetime import timedelta, date 
    24 
    3 Class TimeAdjustment(timedelta): 
     5from myplugs.libtracker.dateutil.parser import parse 
     6from myplugs.libtracker.dateutil.relativedelta import relativedelta 
     7 
     8 
     9def msgparse(bot, ievent): 
     10    reply = repr(parse(ievent.txt,fuzzy=True)) 
     11    ievent.reply(reply) 
     12 
     13class TimeAdjustment(relativedelta): 
    414 
    515    adj_date = date.today() 
     
    919 
    1020    # If we aren't given a complete duration of time, we will need to wait 
    11     # until we have one 
     21    # in the User class until we have one 
    1222    waiting = 0 
    1323 
    1424    def __init__(self, start=None, end=None, duration=None, date=None): 
    15  
     25        # All of these should be datetime objects, except for duration which should be 
     26        # a relativedelta object 
    1627        if (not start == None): 
    1728            self.start = start 
     
    2334            self.duration = duration 
    2435            waiting = 0 
    25         if (not date == None) 
     36        if (not date == None): 
    2637            adj_date = date 
     38 
     39 
  • trunk/antimatter/luke/myplugs/libtracker/tracker.py

    r156 r157  
    55 
    66import myplugs.libtracker.auth as auth 
     7from myplugs.libtracker.timeparser import msgparse 
    78 
    89def init(): 
     
    1112def tracker(bot, ievent): 
    1213    user = auth.check_auth(ievent) 
     14    msgparse(bot, ievent) 
    1315 
    1416def authenticate(bot, ievent): 
  • trunk/antimatter/luke/myplugs/libtracker/__init__.py

    r151 r157  
    1 __all__ = ['auth', 'user', 'tracker'] 
     1__all__ = ['timeparser', 'auth', 'user', 'tracker'] 

SFLC Main Page

[frdm] Support SFLC