[CalendarServer-changes] [2214] CalendarServer/branches/users/wsanchez/guid-calendars/twistedcaldav/ schedule.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 7 11:03:52 PST 2008
Revision: 2214
http://trac.macosforge.org/projects/calendarserver/changeset/2214
Author: wsanchez at apple.com
Date: 2008-03-07 11:03:49 -0800 (Fri, 07 Mar 2008)
Log Message:
-----------
Clean up variable names
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/guid-calendars/twistedcaldav/schedule.py
Modified: CalendarServer/branches/users/wsanchez/guid-calendars/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/branches/users/wsanchez/guid-calendars/twistedcaldav/schedule.py 2008-03-07 18:25:01 UTC (rev 2213)
+++ CalendarServer/branches/users/wsanchez/guid-calendars/twistedcaldav/schedule.py 2008-03-07 19:03:49 UTC (rev 2214)
@@ -200,9 +200,9 @@
x.getResult()
# Must be content-type text/calendar
- content_type = request.headers.getHeader("content-type")
- if content_type is not None and (content_type.mediaType, content_type.mediaSubtype) != ("text", "calendar"):
- logging.err("MIME type %s not allowed in calendar collection" % (content_type,), system="CalDAV Outbox POST")
+ contentType = request.headers.getHeader("content-type")
+ if contentType is not None and (contentType.mediaType, contentType.mediaSubtype) != ("text", "calendar"):
+ logging.err("MIME type %s not allowed in calendar collection" % (contentType,), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "supported-calendar-data")))
# Must have Originator header
@@ -214,37 +214,37 @@
originator = originator[0]
# Verify that Originator is a valid calendar user (has an INBOX)
- oprincipal = self.principalForCalendarUserAddress(originator)
- if oprincipal is None:
+ originatorPrincipal = self.principalForCalendarUserAddress(originator)
+ if originatorPrincipal is None:
logging.err("Could not find principal for originator: %s" % (originator,), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "originator-allowed")))
- inboxURL = oprincipal.scheduleInboxURL()
+ inboxURL = originatorPrincipal.scheduleInboxURL()
if inboxURL is None:
logging.err("Could not find inbox for originator: %s" % (originator,), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "originator-allowed")))
# Verify that Originator matches the authenticated user
- if davxml.Principal(davxml.HRef(oprincipal.principalURL())) != self.currentPrincipal(request):
+ if davxml.Principal(davxml.HRef(originatorPrincipal.principalURL())) != self.currentPrincipal(request):
logging.err("Originator: %s does not match authorized user: %s" % (originator, self.currentPrincipal(request).children[0],), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "originator-allowed")))
# Get list of Recipient headers
- rawrecipients = request.headers.getRawHeaders("recipient")
- if rawrecipients is None or (len(rawrecipients) == 0):
+ rawRecipients = request.headers.getRawHeaders("recipient")
+ if rawRecipients is None or (len(rawRecipients) == 0):
logging.err("POST request must have at least one Recipient header", system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "recipient-specified")))
# Recipient header may be comma separated list
recipients = []
- for rawrecipient in rawrecipients:
- for r in rawrecipient.split(","):
+ for rawRecipient in rawRecipients:
+ for r in rawRecipient.split(","):
r = r.strip()
if len(r):
recipients.append(r)
- timerange = TimeRange(start="20000101", end="20000102")
- recipients_state = {"OK":0, "BAD":0}
+ timeRange = TimeRange(start="20000101", end="20000102")
+ recipientsState = {"OK":0, "BAD":0}
# Parse the calendar object from the HTTP request stream
try:
@@ -281,9 +281,9 @@
outboxURL = None
organizer = calendar.getOrganizer()
if organizer is not None:
- oprincipal = self.principalForCalendarUserAddress(organizer)
- if oprincipal is not None:
- outboxURL = oprincipal.scheduleOutboxURL()
+ organizerPrincipal = self.principalForCalendarUserAddress(organizer)
+ if organizerPrincipal is not None:
+ outboxURL = organizerPrincipal.scheduleOutboxURL()
if outboxURL is None:
logging.err("ORGANIZER in calendar data is not valid: %s" % (calendar,), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "organizer-allowed")))
@@ -305,11 +305,11 @@
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "attendee-allowed")))
# Attendee's Outbox MUST be the request URI
- aoutboxURL = None
- aprincipal = self.principalForCalendarUserAddress(attendees[0])
- if aprincipal is not None:
- aoutboxURL = aprincipal.scheduleOutboxURL()
- if aoutboxURL is None or aoutboxURL != request.uri:
+ attendeeOutboxURL = None
+ attendeePrincipal = self.principalForCalendarUserAddress(attendees[0])
+ if attendeePrincipal is not None:
+ attendeeOutboxURL = attendeePrincipal.scheduleOutboxURL()
+ if attendeeOutboxURL is None or attendeeOutboxURL != request.uri:
logging.err("ATTENDEE in calendar data does not match owner of Outbox: %s" % (calendar,), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "attendee-allowed")))
@@ -326,11 +326,11 @@
if dtstart is None or dtend is None:
logging.err("VFREEBUSY start/end not valid: %s" % (calendar,), system="CalDAV Outbox POST")
raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "valid-calendar-data")))
- timerange.start = dtstart
- timerange.end = dtend
+ timeRange.start = dtstart
+ timeRange.end = dtend
# Look for maksed UID
- excludeuid = calendar.getMaskUID()
+ excludeUID = calendar.getMaskUID()
# Do free busy operation
freebusy = True
@@ -367,7 +367,7 @@
if inbox is None:
err = HTTPError(ErrorResponse(responsecode.NOT_FOUND, (caldav_namespace, "recipient-exists")))
responses.add(recipient, Failure(exc_value=err), reqstatus="3.7;Invalid Calendar User")
- recipients_state["BAD"] += 1
+ recipientsState["BAD"] += 1
# Process next recipient
continue
@@ -376,14 +376,14 @@
# Check access controls
#
try:
- d = waitForDeferred(inbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef(oprincipal.principalURL()))))
+ d = waitForDeferred(inbox.checkPrivileges(request, (caldavxml.Schedule(),), principal=davxml.Principal(davxml.HRef(organizerPrincipal.principalURL()))))
yield d
d.getResult()
except AccessDeniedError:
logging.err("Could not access Inbox for recipient: %s" % (recipient,), system="CalDAV Outbox POST")
err = HTTPError(ErrorResponse(responsecode.NOT_FOUND, (caldav_namespace, "recipient-permisions")))
responses.add(recipient, Failure(exc_value=err), reqstatus="3.8;No authority")
- recipients_state["BAD"] += 1
+ recipientsState["BAD"] += 1
# Process next recipient
continue
@@ -412,46 +412,47 @@
yield availability
availability = availability.getResult()
availability = availability.calendar()
- report_common.processAvailabilityFreeBusy(availability, fbinfo, timerange)
+ report_common.processAvailabilityFreeBusy(availability, fbinfo, timeRange)
# Check to see if the recipient is the same calendar user as the organizer.
# Needed for masked UID stuff.
- same_calendar_user = oprincipal.principalURL() == principal.principalURL()
+ same_calendar_user = organizerPrincipal.principalURL() == principal.principalURL()
# Now process free-busy set calendars
matchtotal = 0
- for calURL in fbset:
- cal = waitForDeferred(request.locateResource(calURL))
- yield cal
- cal = cal.getResult()
- if cal is None or not cal.exists() or not isCalendarCollectionResource(cal):
+ for calendarResourceURL in fbset:
+ calendarResource = waitForDeferred(request.locateResource(calendarResourceURL))
+ yield calendarResource
+ calendarResource = calendarResource.getResult()
+ if calendarResource is None or not calendarResource.exists() or not isCalendarCollectionResource(calendarResource):
# We will ignore missing calendars. If the recipient has failed to
# properly manage the free busy set that should not prevent us from working.
continue
matchtotal = waitForDeferred(report_common.generateFreeBusyInfo(
request,
- cal,
+ calendarResource,
fbinfo,
- timerange,
+ timeRange,
matchtotal,
- excludeuid=excludeuid,
- organizer=organizer,
- same_calendar_user=same_calendar_user))
+ excludeuid = excludeUID,
+ organizer = organizer,
+ same_calendar_user = same_calendar_user
+ ))
yield matchtotal
matchtotal = matchtotal.getResult()
# Build VFREEBUSY iTIP reply for this recipient
- fbresult = report_common.buildFreeBusyResult(fbinfo, timerange, organizer=organizerProp, attendee=attendeeProp, uid=uid, method="REPLY")
+ fbresult = report_common.buildFreeBusyResult(fbinfo, timeRange, organizer=organizerProp, attendee=attendeeProp, uid=uid, method="REPLY")
responses.add(recipient, responsecode.OK, reqstatus="2.0;Success", calendar=fbresult)
- recipients_state["OK"] += 1
+ recipientsState["OK"] += 1
except:
logging.err("Could not determine free busy information: %s" % (recipient,), system="CalDAV Outbox POST")
err = HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "recipient-permissions")))
responses.add(recipient, Failure(exc_value=err), reqstatus="3.8;No authority")
- recipients_state["BAD"] += 1
+ recipientsState["BAD"] += 1
else:
# Hash the iCalendar data for use as the last path element of the URI path
@@ -481,7 +482,7 @@
try:
d.getResult()
responses.add(recipient, responsecode.OK, reqstatus="2.0;Success")
- recipients_state["OK"] += 1
+ recipientsState["OK"] += 1
# Store CALDAV:originator property
child.writeDeadProperty(caldavxml.Originator(davxml.HRef(originator)))
@@ -496,7 +497,7 @@
logging.err("Could not store data in Inbox : %s" % (inbox,), system="CalDAV Outbox POST")
err = HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "recipient-permissions")))
responses.add(recipient, Failure(exc_value=err), reqstatus="3.8;No authority")
- recipients_state["BAD"] += 1
+ recipientsState["BAD"] += 1
# Now we have to do auto-respond
if len(autoresponses) != 0:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080307/c0d5dce8/attachment-0001.html
More information about the calendarserver-changes
mailing list