Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not marshall time fields correctly #15

Open
GoogleCodeExporter opened this issue Apr 12, 2015 · 1 comment
Open

Does not marshall time fields correctly #15

GoogleCodeExporter opened this issue Apr 12, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Query a Case with a time field from BusinessHours (ie 
BusinessHours.MondayStartTime)
2. Will fail during .query call

What is the expected output? What do you see instead?
The data marshalled into a datetime.time

Original issue reported on code.google.com by [email protected] on 11 Sep 2013 at 3:18

@GoogleCodeExporter
Copy link
Author

It appears to be as easy as adding to following to marshall.py

timeregx = re.compile(r'(\d{2}):(\d{2}):(\d{2})(\.\d+)(.*)') # Line 12

# Line 115
def timeMarshaller(fieldname, xml, ns):
    timestr = str(xml[getattr(ns,fieldname)])
    match = timeregx.match(timestr)
    if match:
        grps = match.groups()
        hour = int(grps[0])
        minute = int(grps[1])
        second = int(grps[2])
        secfrac = float(grps[3])
        microsecond = int(secfrac * (10**6))
        tz = grps[4] # XXX not sure if I need to do anything with this. sofar
                     # times appear to be UTC
        return datetime.time(hour, minute, second, microsecond)
    return None


register('time', timeMarshaller)

Original comment by [email protected] on 11 Sep 2013 at 3:53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant