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

File system file support #6

Merged
merged 2 commits into from
Oct 3, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Pass/save full header/metadata element to PyOAI object
  • Loading branch information
arski committed Jul 16, 2013
commit 46a57f8734b11f5ec39f2ff3b121978b717e97b7
2 changes: 1 addition & 1 deletion src/oaipmh/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def buildHeader(header_node, namespaces):
str(e('string(oai:datestamp/text())')))
setspec = [str(s) for s in e('oai:setSpec/text()')]
deleted = e("@status = 'deleted'")
return common.Header(identifier, datestamp, setspec, deleted)
return common.Header(header_node, identifier, datestamp, setspec, deleted)

def ResumptionListGenerator(firstBatch, nextBatch):
result, token = firstBatch()
Expand Down
18 changes: 13 additions & 5 deletions src/oaipmh/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
from oaipmh import error

class Header(object):
def __init__(self, identifier, datestamp, setspec, deleted):
def __init__(self, element, identifier, datestamp, setspec, deleted):
self._element = element
# force identifier to be a string, it might be
# an lxml.etree._ElementStringResult...
self._identifier = str(identifier)
self._datestamp = datestamp
self._setspec = setspec
self._deleted = deleted


def element(self):
return self._element

def identifier(self):
return self._identifier

def datestamp(self):
return self._datestamp

Expand All @@ -24,12 +28,16 @@ def isDeleted(self):
return self._deleted

class Metadata(object):
def __init__(self, map):
def __init__(self, element, map):
self._element = element
self._map = map

def element(self):
return self._element

def getMap(self):
return self._map

def getField(self, name):
return self._map[name]

Expand Down
2 changes: 1 addition & 1 deletion src/oaipmh/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __call__(self, element):
else:
raise Error, "Unknown field type: %s" % field_type
map[field_name] = value
return common.Metadata(map)
return common.Metadata(element, map)

oai_dc_reader = MetadataReader(
fields={
Expand Down