示例#1
0
	def getDateStamp (self, unionDate, default=None):
		if unionDate:
			return unionDateToSecs (unionDate)
		elif default:
			return unionDateToSecs (default)
		else:
			return time.time()
示例#2
0
class FY2010Result(OsmSearchResult):

    start = unionDateToSecs("2009-10-01")
    end = unionDateToSecs("2010-09-30")

    def isFY2010Date(self, dateStr):
        secs = unionDateToSecs(dateStr)
        return secs >= self.start and secs <= self.end

    def hasFY2010Date(self):
        """
		return True if any date is between self.start and self.end
		"""
        dateMap = self.payload.getDateMap()
        if dateMap:
            for dateType in dateMap.keys():

                values = dateMap[dateType]
                if not values:
                    return False
                if not type(values) == type([]):
                    values = [values]
                for val in values:
                    if self.isFY2010Date(val):
                        # print "%s -> %s" % (dateType, val)
                        return True
                    else:
                        # print "NOPE: %s -> %s" % (dateType, val)
                        pass
示例#3
0
 def __init__(self, contributor, recId, date):
     self.contributor = contributor
     self.recId = recId
     self.date = date
     self.timestamp = unionDateToSecs(date)
示例#4
0
from UserList import UserList
from UserDict import UserDict
from serviceclient import ServiceClient, URL
from JloXml import XmlRecord, XmlUtils
from ncar_lib import RepositorySearcher, OsmSearchResult, unionDateToSecs
"""
Use search service to retrieve a batch of records and then process them
"""

default_baseUrl = "http://nldr.library.ucar.edu/schemedit/services/ddsws1-1"

start_secs = unionDateToSecs("2010-08-16")
end_secs = unionDateToSecs("2010-11-1")


def submitterFilter(None, result):
    submitters = result.payload.getContributorPeople("Submitter")
    recordDate = unionDateToSecs(result.payload.getRecordDate())
    return submitters and start_secs <= recordDate and recordDate < end_secs


class Submission:
    def __init__(self, contributor, recId, date):
        self.contributor = contributor
        self.recId = recId
        self.date = date
        self.timestamp = unionDateToSecs(date)

    def __cmp__(self, other):
        return cmp(self.timestamp, other.timestamp)
示例#5
0
 def isFY2010Date(self, dateStr):
     secs = unionDateToSecs(dateStr)
     return secs >= self.start and secs <= self.end