changeset 18:6f8e599199bb

removed useless files
author Marco Fabiani <marco.fabiani@eecs.qmul.ac.uk>
date Tue, 29 May 2012 12:49:00 +0100
parents 509a22aa26c6
children 57bc248c367a
files sword2-libraries-pyinstaller-compatible/sword2/__init__.pyc sword2-libraries-pyinstaller-compatible/sword2/atom_objects.pyc sword2-libraries-pyinstaller-compatible/sword2/collection.pyc sword2-libraries-pyinstaller-compatible/sword2/compatible_libs.pyc sword2-libraries-pyinstaller-compatible/sword2/connection.py.orig sword2-libraries-pyinstaller-compatible/sword2/connection.pyc sword2-libraries-pyinstaller-compatible/sword2/deposit_receipt.py.orig sword2-libraries-pyinstaller-compatible/sword2/deposit_receipt.pyc sword2-libraries-pyinstaller-compatible/sword2/error_document.pyc sword2-libraries-pyinstaller-compatible/sword2/exceptions.pyc sword2-libraries-pyinstaller-compatible/sword2/implementation_info.pyc sword2-libraries-pyinstaller-compatible/sword2/server_errors.pyc sword2-libraries-pyinstaller-compatible/sword2/service_document.pyc sword2-libraries-pyinstaller-compatible/sword2/sword2_logging.pyc sword2-libraries-pyinstaller-compatible/sword2/transaction_history.pyc sword2-libraries-pyinstaller-compatible/sword2/utils.pyc sword2-libraries-pyinstaller-compatible/tests/.DS_Store sword2-libraries-pyinstaller-compatible/tests/.cache/c4dm.eecs.qmul.ac.uk,smdmrd-test,swordv2,servicedocument,48aa9f2607a9f6cdddd8639620add899 sword2-libraries-pyinstaller-compatible/tests/LICENSE.txt sword2-libraries-pyinstaller-compatible/tests/PDF1.pdf sword2-libraries-pyinstaller-compatible/tests/PDF2.pdf sword2-libraries-pyinstaller-compatible/tests/README sword2-libraries-pyinstaller-compatible/tests/bagitexample.zip sword2-libraries-pyinstaller-compatible/tests/c4dmprompt.py sword2-libraries-pyinstaller-compatible/tests/c4dmsword.py sword2-libraries-pyinstaller-compatible/tests/cd sword2-libraries-pyinstaller-compatible/tests/dspaceuploader.py sword2-libraries-pyinstaller-compatible/tests/example.zip sword2-libraries-pyinstaller-compatible/tests/example/mets.xml sword2-libraries-pyinstaller-compatible/tests/example/pdf1.pdf sword2-libraries-pyinstaller-compatible/tests/example/pdf2.pdf sword2-libraries-pyinstaller-compatible/tests/example/pdf3.pdf sword2-libraries-pyinstaller-compatible/tests/foo.zip sword2-libraries-pyinstaller-compatible/tests/footest/.DS_Store sword2-libraries-pyinstaller-compatible/tests/footest/PDF1.pdf sword2-libraries-pyinstaller-compatible/tests/footest/subfoo/PDF2.pdf sword2-libraries-pyinstaller-compatible/tests/pdfs.zip sword2-libraries-pyinstaller-compatible/tests/testzip.py
diffstat 37 files changed, 0 insertions(+), 2752 deletions(-) [+]
line wrap: on
line diff
Binary file sword2-libraries-pyinstaller-compatible/sword2/__init__.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/atom_objects.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/collection.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/compatible_libs.pyc has changed
--- a/sword2-libraries-pyinstaller-compatible/sword2/connection.py.orig	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1692 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-This module provides the 'Connection' class, a SWORD2 client.
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD for information
-about the SWORD2 AtomPub profile.
- 
-"""
-from sword2_logging import logging
-conn_l = logging.getLogger(__name__)
-
-from utils import Timer, NS, get_md5, create_multipart_related
-
-from transaction_history import Transaction_History
-from service_document import ServiceDocument
-from deposit_receipt import Deposit_Receipt
-from error_document import Error_Document
-from collection import Sword_Statement
-from exceptions import *
-
-from compatible_libs import etree
-
-import httplib2
-class Connection(object):
-    """
-`Connection` - SWORD2 client
-
-This connection is predicated on having a Service Document (SD), preferably by an instance being constructed with
-the Service Document IRI (SD-IRI) which can dereference to the XML document itself.
-
-
-Contructor parameters:
-    
-There are a number of flags that can be set when getting an instance of this class that affect the behaviour 
-of the client. See the help for `self.__init__` for more details.
-
-Example usage:
-    
->>> from sword2 import Connection
->>> conn = Connection("http://example.org/service-doc")  # An SD-IRI is required.
-
-
-
-
-# Get, validate and parse the document at the SD_IRI:
->>> conn.get_service_document()
-
-# Load a Service Document from a string:
->>> conn.load_service_document(xml_service_doc)
-2011-05-30 01:06:13,251 - sword2.service_document - INFO - Initial SWORD2 validation checks on service document - Valid document? True
-
-# View transaction history (if enabled)
->>> print conn.history.to_pretty_json()
-[
- {
-  "sd_iri": "http://example.org/service-doc", 
-  "timestamp": "2011-05-30T01:05:54.071042", 
-  "on_behalf_of": null, 
-  "type": "init", 
-  "user_name": null
- }, 
- {
-  "IRI": "http://example.org/service-doc", 
-  "valid": true, 
-  "sword_version": "2.0", 
-  "duration": 0.0029349327087402344, 
-  "timestamp": "2011-05-30T01:06:13.253907", 
-  "workspaces_found": [
-   "Main Site", 
-   "Sub-site"
-  ], 
-  "type": "SD Parse", 
-  "maxUploadSize": 16777216
- }
-]
-
-# Start a connection and do not maintain a transaction history
-# Useful for bulk-testing where the history might grow exponentially
->>> conn = Connection(...... , keep_history=False, ....)
-
-# Initialise a connection and get the document at the SD IRI:
-# (Uses the Simple Sword Server as an endpoint - sss.py
-
->>> from sword2 import Connection
->>> c = Connection("http://localhost:8080/sd-uri", download_service_document=True)
-2011-05-30 02:04:24,179 - sword2.connection - INFO - keep_history=True--> This instance will keep a JSON-compatible transaction log of all (SWORD/APP) activities in 'self.history'
-2011-05-30 02:04:24,215 - sword2.connection - INFO - Received a document for http://localhost:8080/sd-uri
-2011-05-30 02:04:24,216 - sword2.service_document - INFO - Initial SWORD2 validation checks on service document - Valid document? True
->>> print c.history
---------------------
-Type: 'init' [2011-05-30T02:04:24.180182]
-Data:
-user_name:   None
-on_behalf_of:   None
-sd_iri:   http://localhost:8080/sd-uri
---------------------
-Type: 'SD_IRI GET' [2011-05-30T02:04:24.215661]
-Data:
-sd_iri:   http://localhost:8080/sd-uri
-response:   {'status': '200', 'content-location': 'http://localhost:8080/sd-uri', 'transfer-encoding': 'chunked', 'server': 'CherryPy/3.1.2 WSGI Server', 'date': 'Mon, 30 May 2011 01:04:24 GMT', 'content-type': 'text/xml'}
-process_duration:   0.0354170799255
---------------------
-Type: 'SD Parse' [2011-05-30T02:04:24.220798]
-Data:
-maxUploadSize:   16777216
-sd_iri:   http://localhost:8080/sd-uri
-valid:   True
-sword_version:   2.0
-workspaces_found:   ['Main Site']
-process_duration:   0.00482511520386
-
-Please see the testsuite for this class for more examples of the sorts of transactions that can be done. (tests/test_connection*.py)
-"""
-
-    def __init__(self, service_document_iri, 
-                       user_name=None,
-                       user_pass=None,
-                       on_behalf_of=None,
-                       download_service_document = False,   # Don't automagically GET the SD_IRI by default
-                       keep_history=True,
-                       cache_deposit_receipts=True,
-                       honour_receipts=True,
-                       error_response_raises_exceptions=True):
-        """
-Creates a new Connection object.
-
-Parameters:
-
-     Connection(service_document_iri,       <--- REQUIRED - use a dummy string here if the SD is local only.
-                
-                # OPTIONAL parameters (default values are shown below)
-                
-                # Authentication parameters:   (can use any method that `httplib2` provides)
-                
-                user_name=None,     
-                user_pass=None,
-                
-                # Set the SWORD2 On Behalf Of value here, for it to be included as part of every transaction
-                # Can be passed to every transaction method (update resource, delete deposit, etc) otherwise
-                
-                on_behalf_of=None,
-                
-                ## Behaviour Flags
-                # Try to GET the service document from the provided SD-IRI in `service_document_iri` if True
-                
-                download_service_document = False,   # Don't automagically GET the SD_IRI by default
-                
-                # Keep a history of all transactions made with the SWORD2 Server
-                # Records details like the response headers, sent headers, times taken and so forth
-                # Kept in a `sword2.transaction_history:Transaction_History` object but can be treated like an ordinary `list`
-                keep_history=True,
-                
-                # Keep a cache of all deposit receipt responses from the server and provide an 'index' to these `sword2.Deposit_Receipt` objects
-                # by Edit-IRI, Content-IRI and Sword-Edit-IRI. (ie given an Edit-IRI, find the deposit receipt for the last received response containing
-                # that IRI.
-                # If the following flag, `honour_receipts` is set to True, packaging checks and other limits set in these receipts will be
-                # honoured.
-                # For example, a request for an item with an invalid packaging type will never reach the server, but throw an exception.
-                
-                cache_deposit_receipts=True,
-                
-                # Make sure to behave as required by the SWORD2 server - not sending too large a file, not asking for invalid packaging types and so on. 
-                
-                honour_receipts=True,
-                
-                # Two means of handling server error responses:
-                #   If set to True - An exception will be thrown from `sword2.exceptions` (caused by any server error response w/ 
-                #      HTTP code greater than or equal to 400)
-                #   OR
-                #   If set to False - A `sword2.error_document:Error_Document` object will be returned.
-                
-                error_response_raises_exceptions=True
-                )
-                
-If a `Connection` is created with the parameter `download_service_document` set to `False`, then no attempt
-to dereference the `service_document_iri` (SD-IRI) will be made at this stage.
-
-To cause it to get or refresh the service document from this IRI, call `self.get_service_document()`
-
-Loading in a locally held Service Document:
-    
->>> conn = Connection(....)
-
->>> with open("service_doc.xml", "r") as f:
-...     conn.load_service_document(f.read())
-
-         
-                """
-        self.sd_iri = service_document_iri
-        self.sd = None
-        
-        # Client behaviour flags:
-        # Honour deposit receipts - eg raise exceptions if interactions are attempted that the service document
-        #                              does not allow without bothering the server - invalid packaging types, max upload sizes, etc
-        self.honour_receipts = honour_receipts   
-        
-        # When error_response_raises_exceptions == True:
-        # Error responses (HTTP codes >399) will raise exceptions (from sword2.exceptions) in response
-        # when False:
-        # Error Responses, if Content-Type is text/xml or application/xml, a sword2.error_document.Error_Document will be the 
-        # return - No Exception will be raised!
-        # Check Error_Document.code to get the response code, regardless to whether a valid Sword2 error document was received.
-        self.raise_except = error_response_raises_exceptions
-        
-        self.keep_cache = cache_deposit_receipts
-        self.h = httplib2.Http(".cache", timeout=30.0)
-        self.user_name = user_name
-        self.on_behalf_of = on_behalf_of
-        
-        # Cached Deposit Receipt 'indexes'  *cough, cough*
-        self.edit_iris = {}          # Key = IRI, Value = ref to latest Deposit Receipt for the resource
-        self.cont_iris = {}          # Key = IRI, Value = ref to latest Deposit Receipt
-        self.se_iris = {}            # Key = IRI, Value = ref to latest Deposit Receipt
-        self.cached_at = {}          # Key = Edit-IRI, Value = Timestamp for when receipt was cached
-        
-        # Transaction history hooks
-        self.history = None
-        self._t = Timer()
-        self.keep_history = keep_history
-        if keep_history:
-            conn_l.info("keep_history=True--> This instance will keep a JSON-compatible transaction log of all (SWORD/APP) activities in 'self.history'")
-            self.reset_transaction_history()
-            self.history.log('init',
-                             sd_iri = self.sd_iri,
-                             user_name = self.user_name,
-                             on_behalf_of = self.on_behalf_of )
-        # Add credentials to http client
-        if user_name:
-            conn_l.info("Adding username/password credentials for the client to use.")
-            self.h.add_credentials(user_name, user_pass)
-        
-        if self.sd_iri and download_service_document:
-            self._t.start("get_service_document")
-            self.get_service_document()
-            conn_l.debug("Getting service document and dealing with the response: %s s" % self._t.time_since_start("get_service_document")[1])
-    
-    def _return_error_or_exception(self, cls, resp, content):
-        """Internal method for reporting errors, behaving as the `self.raise_except` flag requires.
-        
-        `self.raise_except` can be altered at any time to affect this methods behaviour."""
-        if self.raise_except:
-            raise cls(resp)
-        else:
-            if resp['content-type'] in ['text/xml', 'application/xml']:
-                conn_l.info("Returning an error document, due to HTTP response code %s" % resp.status)
-                e = Error_Document(content, code=resp.status, resp = resp)
-                return e
-            else:
-                conn_l.info("Returning due to HTTP response code %s" % resp.status)
-                e = Error_Document(code=resp.status, resp = resp)
-                return e
-    
-    def _handle_error_response(self, resp, content):
-        """Catch a number of general HTTP error responses from the server, based on HTTP code
-        
-        401 - Unauthorised.
-            Will throw a `sword2.exceptions.NotAuthorised` exception, if exceptions are set to be on.
-            Otherwise will return a `sword2.Error_Document` (likewise for the rest of these)
-        
-        403 - Forbidden.
-            Will throw a `sword2.exceptions.Forbidden` exception
-        
-        404 - Not Found.
-            Will throw a `sword2.exceptions.NotFound` exception
-        
-        408 - Request Timeout
-            Will throw a `sword2.exceptions.RequestTimeOut` exception
-        
-        500-599 errors:
-            Will throw a general `sword2.exceptions.ServerError` exception
-        
-        4XX not listed:
-            Will throw a general `sword2.exceptions.HTTPResponseError` exception
-        """
-        if resp['status'] == "401":
-            conn_l.error("You are unauthorised (401) to access this document on the server. Check your username/password credentials and your 'On Behalf Of'")
-            self._return_error_or_exception(NotAuthorised, resp, content)
-        elif resp['status'] == "403":
-            conn_l.error("You are Forbidden (401) to POST to '%s'. Check your username/password credentials and your 'On Behalf Of'")
-            self._return_error_or_exception(Forbidden, resp, content)
-        elif resp['status'] == "408":
-            conn_l.error("Request Timeout (408) - error uploading.")
-            self._return_error_or_exception(RequestTimeOut, resp, content)
-        elif int(resp['status']) > 499:
-            conn_l.error("Server error occured. Response headers from the server:\n%s" % resp)
-            self._return_error_or_exception(ServerError, resp, content)
-        else:
-            conn_l.error("Unknown error occured. Response headers from the server:\n%s" % resp)
-            self._return_error_or_exception(HTTPResponseError, resp, content)
-    
-    def _cache_deposit_receipt(self, d):
-        """Method for storing the deposit receipts, and also for providing lookup dictionaries that
-        reference these objects.
-        
-        (only provides cache if `self.keep_cache` is `True` [via the `cache_deposit_receipts` init parameter flag])
-        
-        Provides and maintains:
-            self.edit_iris -- a `dict`, keys: Edit-IRI hrefs, values: `sword2.Deposit_Receipt` objects they appear in
-            
-            self.cont_iris -- a `dict`, keys: Content-IRI hrefs, values: `sword2.Deposit_Receipt` objects they appear in
-            
-            self.se_iris -- a `dict`, keys: Sword-Edit-IRI hrefs, values: `sword2.Deposit_Receipt` objects they appear in
-            
-            self.cached_at -- a `dict`, keys: Edit-IRIs, values: timestamp when receipt was last cached.
-        """
-        if self.keep_cache:
-            timestamp = self._t.get_timestamp()
-            conn_l.debug("Caching document (Edit-IRI:%s) - at %s" % (d.edit, timestamp))
-            self.edit_iris[d.edit] = d
-            if d.cont_iri:   # SHOULD exist within receipt
-                self.cont_iris[d.cont_iri] = d
-            if d.se_iri:     
-                # MUST exist according to the spec, but as it can be the same as the Edit-IRI
-                # it seems likely that a server implementation might ignore the 'MUST' part.
-                self.se_iris[d.se_iri] = d
-            self.cached_at[d.edit] = self._t.get_timestamp()
-        else:
-            conn_l.debug("Caching request denied - deposit receipt caching is set to 'False'")
-    
-    def load_service_document(self, xml_document):
-        """Load the Service Document XML from bytestring, `xml_document`
-        
-        Useful if SD-IRI is non-existant or invalid.
-        
-        Will set the following convenience attributes:
-            
-            `self.sd` -- the `sword2.ServiceDocument` instance
-            
-            `self.workspaces` -- a `list` of workspace tuples, of the form:
-                            ('Workspace atom:title', [<`sword2.Collection` object>, ....]),
-            
-            `self.maxUploadSize` -- the maximum filesize for a deposit, if given in the service document
-        """
-        self._t.start("SD Parse")
-        self.sd = ServiceDocument(xml_document)
-        _, took_time = self._t.time_since_start("SD Parse")
-        # Set up some convenience references
-        self.workspaces = self.sd.workspaces
-        self.maxUploadSize = self.sd.maxUploadSize
-        
-        if self.history:
-            if self.sd.valid:
-                self.history.log('SD Parse', 
-                                 sd_iri = self.sd_iri,
-                                 valid = self.sd.valid,
-                                 workspaces_found = [k for k,v in self.sd.workspaces],
-                                 sword_version = self.sd.version,
-                                 maxUploadSize = self.sd.maxUploadSize,
-                                 process_duration = took_time)
-            else:
-                self.history.log('SD Parse', 
-                                 sd_iri = self.sd_iri,
-                                 valid = self.sd.valid,
-                                 process_duration = took_time)
-    
-    def get_service_document(self):
-        """Perform an HTTP GET on the Service Document IRI (SD-IRI) and attempt to parse the result as
-        a SWORD2 Service Document (using `self.load_service_document`)
-        """
-        headers = {}
-        if self.on_behalf_of:
-            headers['on-behalf-of'] = self.on_behalf_of
-        self._t.start("SD_URI request")
-        resp, content = self.h.request(self.sd_iri, "GET", headers=headers)
-        _, took_time = self._t.time_since_start("SD_URI request")
-        if self.history:
-            self.history.log('SD_IRI GET', 
-                             sd_iri = self.sd_iri,
-                             response = resp, 
-                             process_duration = took_time)
-        if resp['status'] == "200":
-            conn_l.info("Received a document for %s" % self.sd_iri)
-            self.load_service_document(content)
-        elif resp['status'] == "401":
-            conn_l.error("You are unauthorised (401) to access this document on the server. Check your username/password credentials")
-        
-    def reset_transaction_history(self):
-        """ Clear the transaction history - `self.history`"""
-        del self.history
-        self.history = Transaction_History()
-
-    def _make_request(self,
-                      target_iri, 
-                      payload=None,       # These need to be set to upload a file
-                      mimetype=None,      
-                      filename=None,
-                      packaging=None,
-                        
-                      metadata_entry=None,  # a sword2.Entry needs to be here, if 
-                                              # a metadata entry is to be uploaded
-                        
-                      # Set both a file and a metadata entry for the method to perform a multipart
-                      # related upload.
-                      suggested_identifier=None,   # 'slug'
-                      in_progress=True,
-                      on_behalf_of=None,
-                      metadata_relevant=False,
-                      
-                      # flags:
-                      empty = None,     # If this is True, then the POST/PUT is sent with an empty body
-                                        # and the 'Content-Length' header explicitly set to 0
-                      method = "POST",
-                      request_type=""       # text label for transaction history reports
-                      ):
-        """Performs an HTTP request, as defined by the parameters. This is an internally used method and it is best that it
-        is not called directly.
-        
-        target_iri -- IRI that will be the target of the HTTP call
-        
-        # File upload parameters:
-        payload   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-        mimetype  - MIMEType of the payload
-        filename  - filename. Most SWORD2 uploads have this as being mandatory.
-        packaging - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-        
-        # NB to work around a possible bug in httplib2 0.6.0, the file-like object is read into memory rather than streamed
-        # from disc, so is not as efficient as it should be. That said, it is recommended that file handles are passed to 
-        # the _make_request method, as this is hoped to be a temporary situation.
-        
-        metadata_entry  - a `sword2.Entry` to be uploaded with metadata fields set as desired.
-        
-        # If there is both a payload and a metadata_entry, then the request will be made as a Multipart-related request
-        # Otherwise, it will be a normal request for whicever type of upload.
-        
-        empty   - a flag to specify that an empty request should be made. A blank body and a 'Content-Length:0' header will be explicitly added
-                  and any payload or metadata_entry passed in will be ignored.
-        
-        
-        # Header flags:
-        suggested_identifier    -- set the 'Slug' header
-        in_progress             --         'In-Progress'
-        on_behalf_of            --         'On-Behalf-Of' 
-        metadata_relevant       --         'Metadata-Relevant'
-        
-        # HTTP settings:
-        method          -- "GET", "POST", etc
-        request_type    -- A label to be used in the transaction history for this particular operation. 
-        
-        Response:
-        
-        A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-        not a Deposit Response, then only a few attributes will be populated:
-            
-        `code` -- HTTP code of the response
-        `response_headers`  -- `dict` of the reponse headers
-        `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-        If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-        then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-        response_headers, etc)
-        """
-        if payload:
-            md5sum, f_size = get_md5(payload)
-        
-        # request-level headers
-        headers = {}
-        headers['In-Progress'] = str(in_progress).lower()
-        if on_behalf_of:
-            headers['On-Behalf-Of'] = self.on_behalf_of
-        elif self.on_behalf_of:
-            headers['On-Behalf-Of'] = self.on_behalf_of
-            
-        if suggested_identifier:
-            headers['Slug'] = str(suggested_identifier)
-            
-        if suggested_identifier:
-            headers['Slug'] = str(suggested_identifier)
-        
-        if metadata_relevant:
-            headers['Metadata-Relevant'] = str(metadata_relevant).lower()
-        
-        if hasattr(payload, 'read'):
-            # Need to work out why a 401 challenge will stop httplib2 from sending the file...
-            # likely need to make it re-seek to 0...
-            # In the meantime, read the file into memory... *sigh*
-            payload = payload.read()
-        
-        self._t.start(request_type)
-        if empty:
-            # NULL body with explicit zero length.
-            headers['Content-Length'] = "0"
-            resp, content = self.h.request(target_iri, method, headers=headers)
-            _, took_time = self._t.time_since_start(request_type)
-            if self.history:
-                self.history.log(request_type + ": Empty request", 
-                                 sd_iri = self.sd_iri,
-                                 target_iri = target_iri,
-                                 method = method,
-                                 response = resp,
-                                 headers = headers,
-                                 process_duration = took_time)  
-        elif method == "DELETE":
-            resp, content = self.h.request(target_iri, method, headers=headers)
-            _, took_time = self._t.time_since_start(request_type)
-            if self.history:
-                self.history.log(request_type + ": DELETE request", 
-                                 sd_iri = self.sd_iri,
-                                 target_iri = target_iri,
-                                 method = method,
-                                 response = resp,
-                                 headers = headers,
-                                 process_duration = took_time)
-            
-        elif metadata_entry and not (filename and payload):
-            # Metadata-only resource creation
-            headers['Content-Type'] = "application/atom+xml;type=entry"
-            data = str(metadata_entry)
-            headers['Content-Length'] = str(len(data))
-            
-            resp, content = self.h.request(target_iri, method, headers=headers, body = data)
-            _, took_time = self._t.time_since_start(request_type)
-            if self.history:
-                self.history.log(request_type + ": Metadata-only resource request", 
-                                 sd_iri = self.sd_iri,
-                                 target_iri = target_iri,
-                                 method = method,
-                                 response = resp,
-                                 headers = headers,
-                                 process_duration = took_time)
-            
-        elif metadata_entry and filename and payload:
-            # Multipart resource creation
-            multicontent_type, payload_data = create_multipart_related([{'key':'atom',
-                                                                    'type':'application/atom+xml; charset="utf-8"',
-                                                                    'data':str(metadata_entry),  # etree default is utf-8
-                                                                    },
-                                                                    {'key':'payload',
-                                                                    'type':str(mimetype),
-                                                                    'filename':filename,
-                                                                    'data':payload,  
-                                                                    'headers':{'Content-MD5':str(md5sum),
-                                                                               'Packaging':str(packaging),
-                                                                               }
-                                                                    }
-                                                                   ])
-                                                                   
-            headers['Content-Type'] = multicontent_type + '; type="application/atom+xml"'
-            headers['Content-Length'] = str(len(payload_data))    # must be str, not int type
-            resp, content = self.h.request(target_iri, method, headers=headers, body = payload_data)
-            _, took_time = self._t.time_since_start(request_type)
-            if self.history:
-                self.history.log(request_type + ": Multipart resource request",
-                                 sd_iri = self.sd_iri,
-                                 target_iri = target_iri,
-                                 response = resp,
-                                 headers = headers,
-                                 method = method,
-                                 multipart = [{'key':'atom',
-                                               'type':'application/atom+xml; charset="utf-8"'
-                                              },
-                                              {'key':'payload',
-                                               'type':str(mimetype),
-                                               'filename':filename,
-                                               'headers':{'Content-MD5':str(md5sum),
-                                                          'Packaging':str(packaging),
-                                                         }
-                                               }],   # record just the headers used in multipart construction
-                                 process_duration = took_time)
-        elif filename and payload:
-            headers['Content-Type'] = str(mimetype)
-            headers['Content-MD5'] = str(md5sum)
-            headers['Content-Length'] = str(f_size)
-            headers['Content-Disposition'] = "attachment; filename=%s" % filename   # TODO: ensure filename is ASCII
-            headers['Packaging'] = str(packaging)
-            
-            resp, content = self.h.request(target_iri, method, headers=headers, body = payload)
-            _, took_time = self._t.time_since_start(request_type)
-            if self.history:
-                self.history.log(request_type + ": simple resource request",
-                                 sd_iri = self.sd_iri,
-                                 target_iri = target_iri,
-                                 method = method,
-                                 response = resp,
-                                 headers = headers,
-                                 process_duration = took_time)
-        else:
-            conn_l.error("Parameters were not complete: requires a metadata_entry, or a payload/filename/packaging or both")
-            raise Exception("Parameters were not complete: requires a metadata_entry, or a payload/filename/packaging or both")
-        
-        if resp['status'] == "201":
-            #   Deposit receipt in content
-            conn_l.info("Received a Resource Created (201) response.")
-            # Check response headers for updated Location IRI
-            location = resp.get('location', None)
-            if len(content) > 0:
-                # Fighting chance that this is a deposit receipt
-                d = Deposit_Receipt(xml_deposit_receipt = content)
-                if d.parsed:
-                    conn_l.info("Server response included a Deposit Receipt. Caching a copy in .resources['%s']" % d.edit)
-                d.response_headers = dict(resp)
-                d.location = location
-                d.code = 201
-                self._cache_deposit_receipt(d)
-                return d
-            else:
-                # No body...
-                d = Deposit_Receipt()
-                conn_l.info("Server response dir not include a Deposit Receipt.")
-                d.response_headers = dict(resp)
-                d.code = 201
-                d.location = location
-                return d
-        elif resp['status'] == "204":
-            #   Deposit receipt in content
-            conn_l.info("Received a valid 'No Content' (204) response.")
-            location = resp.get('location', None)
-            # Check response headers for updated Locatio
-            return Deposit_Receipt(response_headers = dict(resp), location=location, code=204)
-        elif resp['status'] == "200":
-            #   Deposit receipt in content
-            conn_l.info("Received a valid (200) OK response.")
-            content_type = resp.get('content-type')
-            location = resp.get('location', None)
-            if content_type == "application/atom+xml;type=entry" and len(content) > 0:
-                d = Deposit_Receipt(content)
-                if d.parsed:
-                    conn_l.info("Server response included a Deposit Receipt. Caching a copy in .resources['%s']" % d.edit)
-                    d.response_headers = dict(resp)
-                    d.location = location
-                    d.code = 200
-                    self._cache_deposit_receipt(d)
-                    return d
-            else:
-                # No atom entry...
-                d = Deposit_Receipt()
-                conn_l.info("Server response dir not include a Deposit Receipt Entry.")
-                d.response_headers = dict(resp)
-                d.location = location
-                d.content = content
-                return d
-        else:
-            return self._handle_error_response(resp, content)
-        
-
-    
-    def create(self, 
-                        workspace=None,     # Either provide workspace/collection or
-                        collection=None,    # the exact Col-IRI itself
-                        col_iri=None,  
-                        
-                        payload=None,       # These need to be set to upload a file
-                        mimetype=None,      
-                        filename=None,
-                        packaging=None,
-                        
-                        metadata_entry=None,  # a sword2.Entry needs to be here, if 
-                                              # a metadata entry is to be uploaded
-                        
-                        # Set both a file and a metadata entry for the method to perform a multipart
-                        # related upload.
-                        
-                        suggested_identifier=None,
-                        in_progress=True,
-                        on_behalf_of=None,
-                        ):
-        """
-Creating a Resource
-===================
-                
-#BETASWORD2URL
-See 6.3 Creating a Resource http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_creatingresource
-
-Basic parameters:
-
-This method can create a new resource in a Collection on a SWORD2 server, given suitable authentication to do so.
-        
-Select a collection to send a request to by either:
-            
-    setting the param `col_iri` to its Collection-IRI or Col-IRI 
-    
-        or
-    
-    setting 'workspace' and 'collection' to the labels for the desired workspace and collection.
-
-SWORD2 request parameters:
-
-    `suggested_identifier`              -- the suggested identifier of this resource (HTTP header of 'Slug'), 
-
-    `in_progress` (`True` or `False`)   -- whether or not the deposit should be considered by the 
-                                           server to be in progress ('In-Progress') 
-    `on_behalf_of`                      -- if this is a mediated deposit ('On-Behalf-Of') 
-                                           (the client-wide setting `self.on_behalf_of will be used otherwise)    
-
-        
-1. "Binary File Deposit in a given Collection"
-----------------------------------------------
-            
-Set the following parameters in addition to the basic parameters:
-
-    `payload`   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-    `mimetype`  - MIMEType of the payload
-    `filename`  - filename. Most SWORD2 uploads have this as being mandatory.
-    `packaging` - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-        
-Response:
-
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-2. "Creating a Resource with an Atom Entry"
--------------------------------------------
-
-create a container within a SWORD server and optionally provide it with metadata without adding any binary content to it. 
-
-Set the following parameters in addition to the basic parameters:
-    
-    `metadata_entry`  - An instance of `sword2.Entry`, set with the metadata required.
-    
-for example:
-    # conn = `sword2.Connection`, collection_iri = Collection-IRI
-    >>> from sword2 import Entry
-    >>> entry = Entry(title = "My new deposit",
-    ...               id = "foo:id",
-    ...               dcterms_abstract = "My Thesis",
-    ...               dcterms_author = "Me",
-    ...               dcterms_issued = "2009")
-    
-    >>> conn.create(col_iri = collection_iri,
-    ...                      metadata_entry = entry,
-    ...                      in_progress = True)          
-    # likely to want to add the thesis files later for example but get the identifier for the deposit now
-
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-3. "Creating a Resource with a Multipart Deposit"
--------------------------------------------------
-
-Create a resource in a given collection by uploading a file AND the metadata about this resource.
-
-To make this sort of request, just set the parameters as shown for both the binary upload and the metadata upload.
-
-eg:
-    
-    >>> conn.create(col_iri = collection_iri,
-    ...                      metadata_entry = entry,
-    ...                      payload = open("foo.zip", "r"),
-    ...                      mimetype =  
-                .... and so on
-
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-(under the hood, this request uses Atom Multipart-related)
-
-From the spec:
-
-"In order to ensure that all SWORD clients and servers can exchange a full range of file content and metadata, the use of Atom Multipart [AtomMultipart] is permitted to combine a package (possibly a simple ZIP) with a set of Dublin Core metadata terms [DublinCore] embedded in an Atom Entry.
-
-The SWORD server is not required to support packaging formats, but this profile RECOMMENDS that the server be able to accept a ZIP file as the Media Part of an Atom Multipart request (See Section 5: IRIs and Section 7: Packaging for more details)."
-        """
-        conn_l.debug("Create Resource")
-        if not col_iri:
-            for w, collections in self.workspaces:
-                if w == workspace:
-                    for c in collections:
-                        if c.title == collection:
-                            conn_l.debug("Matched: Workspace='%s', Collection='%s' ==> Col-IRI='%s'" % (workspace, 
-                                                                                                        collection, 
-                                                                                                        c.href))
-                            col_iri = c.href
-                            break
-
-        if not col_iri:   # no col_iri provided and no valid workspace/collection given
-            conn_l.error("No suitable Col-IRI was found, with the given parameters.")
-            return
-        
-        return self._make_request(target_iri = col_iri,
-                                  payload=payload,
-                                  mimetype=mimetype,
-                                  filename=filename,
-                                  packaging=packaging,
-                                  metadata_entry=metadata_entry,
-                                  suggested_identifier=suggested_identifier,
-                                  in_progress=in_progress,
-                                  on_behalf_of=on_behalf_of,
-                                  method="POST",
-                                  request_type='Col_IRI POST')
-        
-    def update(self, metadata_entry = None,    # required for a metadata update
-                             payload = None,            # required for a file update      
-                             filename = None,           # required for a file update
-                             mimetype=None,             # required for a file update
-                             packaging=None,            # required for a file update
-                             
-                             dr = None,     # Important! Without this, you will have to set the edit_iri AND the edit_media_iri parameters.
-                             
-                             edit_iri = None,
-                             edit_media_iri = None,
-
-                             metadata_relevant=False,
-                             in_progress=False,
-                             on_behalf_of=None,
-                      ):
-        """
-Replacing the Metadata and/or Files of a Resource
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_editingcontent_multipart
-
-Replace the metadata and/or files of a resource.
-
-This wraps a number of methods and relies on being passed the Deposit Receipt, as the target IRI changes depending 
-on whether the metadata, the files or both are to be updated by the request. 
-
-This method has the same functionality as the following methods:
-    update_files_for_resource
-    update_metadata_for_resource
-    update_metadata_and_files_for_resource
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-You MUST pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen based on what combination of files you want to upload.
-
-Then, add in the metadata and/or file information as desired:
--------------------------------------------------------------
-
-File information requires:
-
-    `payload`   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-    `mimetype`  - MIMEType of the payload
-    `filename`  - filename. Most SWORD2 uploads have this as being mandatory.
-    `packaging` - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-                    
-    `metadata_relevant` - This should be set to `True` if the server should consider the file a potential source of metadata extraction, 
-                          or `False` if the server should not attempt to extract any metadata from the deposi
-    
-Metadata information requires:
-
-    `metadata_entry`  - An instance of `sword2.Entry`, set with the metadata required.
-    
-for example, to create a metadata entry
-    >>> from sword2 import Entry
-    >>> entry = Entry(title = "My new deposit",
-    ...               id = "new:id",    # atom:id
-    ...               dcterms_abstract = "My Thesis",
-    ...               dcterms_author = "Ben",
-    ...               dcterms_issued = "2010")
-
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-        """
-        target_iri = None
-        request_type = "Update PUT"
-        if metadata_entry != None:
-            # Metadata or Metadata + file --> Edit-IRI
-            conn_l.info("Using the Edit-IRI - Metadata or Metadata + file multipart-related uses a PUT request to the Edit-IRI")
-            if payload != None and filename != None:
-                request_type = "Update Multipart PUT"
-            else:
-                request_type = "Update Metadata PUT"
-            if dr != None and dr.edit != None:
-                conn_l.info("Using the deposit receipt to get the Edit-IRI: %s" % dr.edit)
-                target_iri = dr.edit
-            elif edit_iri != None:
-                conn_l.info("Using the %s receipt as the Edit-IRI" % edit_iri)
-                target_iri = edit_iri
-            else:
-                conn_l.error("Metadata or Metadata + file multipart-related update: Cannot find the Edit-IRI from the parameters supplied.")
-        elif payload != None and filename != None:
-            # File-only --> Edit-Media-IRI
-            conn_l.info("Using the Edit-Media-IRI - File update uses a PUT request to the Edit-Media-IRI")
-            request_type = "Update File PUT"
-            if dr != None and dr.edit_media != None:
-                conn_l.info("Using the deposit receipt to get the Edit-Media-IRI: %s" % dr.edit_media)
-                target_iri = dr.edit_media
-            elif edit_media_iri != None:
-                conn_l.info("Using the %s receipt as the Edit-Media-IRI" % edit_media_iri)
-                target_iri = edit_media_iri
-            else:
-                conn_l.error("File update: Cannot find the Edit-Media-IRI from the parameters supplied.")
-            
-        if target_iri == None:
-            raise Exception("No suitable IRI was found for the request needed.")
-
-        return self._make_request(target_iri = target_iri,
-                                  metadata_entry=metadata_entry, 
-                                  payload=payload,
-                                  mimetype=mimetype,
-                                  filename=filename,
-                                  packaging=packaging,
-                                  on_behalf_of=on_behalf_of,
-                                  in_progress=in_progress,
-                                  metadata_relevant=str(metadata_relevant),
-                                  method="PUT",
-                                  request_type=request_type)
-
-
-        
-    def add_file_to_resource(self, 
-                        edit_media_iri,
-                        payload,       # These need to be set to upload a file      
-                        filename,      # According to spec, "The client MUST supply a Content-Disposition header with a filename parameter 
-                                       #                     (note that this requires the filename be expressed in ASCII)."  
-                        mimetype=None,
-                        
-                        
-                        on_behalf_of=None,
-                        in_progress=False, 
-                        metadata_relevant=False
-                        ):
-        """
-Adding Files to the Media Resource
-
-From the spec, paraphrased:
-    
-    "This feature is for use when clients wish to send individual files to the server and to receive back the IRI for the created resource. [Adding new items to the deposit container] will not give back the location of the deposited resources, so in cases where the server does not provide the (optional) Deposit Receipt, it is not possible for the client to ascertain the location of the file actually deposited - the Location header in that operation is the Edit-IRI. By POSTing to the EM-IRI, the Location header will return the IRI of the deposited file itself, rather than that of the container.
-
-As the EM-IRI represents the Media Resource itself, rather than the Container, this operation will not formally support metadata handling, and therefore also offers no explicit support for packaging either since packages may be both content and metadata. Nonetheless, for files which may contain extractable metadata, there is a Metadata-Relevant header which can be defined to indicate whether the deposit can be used to augment the metadata of the container."
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_addingcontent_mediaresource
-
-
-Set the following parameters in addition to the basic parameters:
-
-    `edit_media_iri` - The Edit-Media-IRI
-    
-    `payload`   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-    `mimetype`  - MIMEType of the payload
-    `filename`  - filename. Most SWORD2 uploads have this as being mandatory.
-    `packaging` - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-        
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-        """
-        conn_l.info("Appending file to a deposit via Edit-Media-IRI %s" % edit_media_iri)
-        return self._make_request(target_iri = edit_media_iri,
-                                  payload=payload,
-                                  mimetype=mimetype,
-                                  filename=filename,
-                                  on_behalf_of=on_behalf_of,
-                                  in_progress=in_progress,
-                                  method="POST",
-                                  metadata_relevant=metadata_relevant,
-                                  request_type='EM_IRI POST (APPEND)')
-
-    def append(self, 
-                        se_iri = None,  
-                        
-                        payload = None,       # These need to be set to upload a file      
-                        filename = None,      # According to spec, "The client MUST supply a Content-Disposition header with a filename parameter 
-                                            #                     (note that this requires the filename be expressed in ASCII)."
-                        mimetype = None,
-                        packaging = None,
-                        on_behalf_of = None,
-                        metadata_entry = None,
-                        metadata_relevant = False,
-                        in_progress = False,
-                        dr = None
-                        ):
-        """
-Adding Content to a Resource
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_addingcontent
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set `se_iri` to be the SWORD2-Edit-IRI for a given deposit. (This can be found in `sword2.Deposit_Receipt.se_iri`)
-
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-
-Then:
------
-
-1. "Adding New Packages or Files to a Container"
-------------------------------------------------
-            
-Set the following parameters in addition to the basic parameters:
-
-    `payload`   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-    `mimetype`  - MIMEType of the payload
-    `filename`  - filename. Most SWORD2 uploads have this as being mandatory.
-    `packaging` - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-        
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-
-2. "Adding New Metadata to a Container"
----------------------------------------
-
-NB SWORD2 does not instruct the server on the best way to handle metadata, only that metadata SHOULD be 
-added and not overwritten; in certain circumstances this may not produce the desired behaviour. 
-
-Set the following parameters in addition to the basic parameters:
-    
-    `metadata_entry`  - An instance of `sword2.Entry`, set with the metadata required.
-    
-for example:
-    # conn = `sword2.Connection`, se_iri = SWORD2-Edit-IRI
-    >>> from sword2 import Entry
-    >>> entry = Entry(dcterms:identifier = "doi://......")
-    >>> conn.add_new_item_to_container(se_iri = se_iri,
-    ...                                metadata_entry = entry)
-              
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-3. "Adding New Metadata and Packages or Files to a Container with Multipart"
-----------------------------------------------------------------------------
-
-Create a resource in a given collection by uploading a file AND the metadata about this resource.
-
-To make this sort of request, just set the parameters as shown for both the binary upload and the metadata upload.
-
-eg:
-    
-    >>> conn.add_new_item_to_container(se_iri = se_iri,
-    ...                      metadata_entry = entry,
-    ...                      payload = open("foo.zip", "r"),
-    ...                      mimetype =  
-                .... and so on
-
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-
-        """
-        
-        if not se_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the SWORD2-Edit-IRI")
-                se_iri = dr.se_iri
-                if se_iri:
-                    conn_l.info("Update Resource via SWORD2-Edit-IRI %s" % se_iri)
-                else:
-                    raise Exception("No SWORD2-Edit-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No SWORD2-Edit-IRI was given")
-        else:
-            conn_l.info("Update Resource via SWORD2-Edit-IRI %s" % se_iri)
-
-        conn_l.info("Adding new file, metadata or both to a SWORD deposit via SWORD-Edit-IRI %s" % se_iri)
-        return self._make_request(target_iri = se_iri,
-                                  payload=payload,
-                                  mimetype=mimetype,
-                                  packaging=packaging,
-                                  filename=filename,
-                                  metadata_entry=metadata_entry,
-                                  on_behalf_of=on_behalf_of,
-                                  in_progress=in_progress, 
-                                  method="POST",
-                                  metadata_relevant=metadata_relevant,
-                                  request_type='SE_IRI POST (APPEND PKG)')
-
-
-    def delete(self,
-                        resource_iri,
-                        on_behalf_of=None):
-        """
-Delete resource
-
-Generic method to send an HTTP DELETE request to a given IRI.
-
-Can be given the optional parameter of `on_behalf_of`.
-        """
-        conn_l.info("Deleting resource %s" % resource_iri)
-        return self._make_request(target_iri = resource_iri,
-                                  on_behalf_of=on_behalf_of,
-                                  method="DELETE",
-                                  request_type='IRI DELETE')
-
-    def delete_content_of_resource(self, edit_media_iri = None,
-                                         on_behalf_of = None,
-                                         dr = None):
-    
-        """
-Deleting the Content of a Resource    
-    
-Remove all the content of a resource without removing the resource itself
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_deletingcontent
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set `edit_media_iri` to be the Edit-Media-IRI for a given resource.
-
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-        """
-        if not edit_media_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the Edit-Media-IRI")
-                edit_media_iri = dr.edit_media
-                if edit_media_iri:
-                    conn_l.info("Deleting Resource via Edit-Media-IRI %s" % edit_media_iri)
-                else:
-                    raise Exception("No Edit-Media-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No Edit-Media-IRI was given")
-        else:
-            conn_l.info("Deleting Resource via Edit-Media-IRI %s" % edit_media_iri)
-
-        return self.delete_resource(edit_media_iri,
-                                    on_behalf_of = on_behalf_of)
-
-
-
-
-
-    def delete_container(self, edit_iri = None,
-                               on_behalf_of = None,
-                               dr = None):
-    
-        """
-Deleting the Container    
-    
-Delete the entire object on the server, effectively removing the deposit entirely.
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_deleteconteiner
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set `edit_iri` to be the Edit-IRI for a given resource.
-
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-
-        """
-        if not edit_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the Edit-IRI")
-                edit_iri = dr.edit
-                if edit_iri:
-                    conn_l.info("Deleting Container via Edit-IRI %s" % edit_iri)
-                else:
-                    raise Exception("No Edit-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No Edit-IRI was given")
-        else:
-            conn_l.info("Deleting Container via Edit-IRI %s" % edit_iri)
-
-        return self.delete_resource(edit_iri,
-                                    on_behalf_of = on_behalf_of)
-            
-    def complete_deposit(self,
-                        se_iri = None,
-                        on_behalf_of=None,
-                        dr = None):
-        """
-Completing a Previously Incomplete Deposit
-
-Use this method to indicate to a server that a deposit which was 'in progress' is now complete. In other words, complete a deposit
-which had the 'In-Progress' flag set to True.
-
-#BETASWORD2URL
-http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#continueddeposit_complete
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set `se_iri` to be the SWORD2-Edit-IRI for a given resource.
-
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-        """
-        
-        if not se_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the SWORD2-Edit-IRI")
-                se_iri = dr.se_iri
-                if se_iri:
-                    conn_l.info("Complete deposit using the SWORD2-Edit-IRI %s" % se_iri)
-                else:
-                    raise Exception("No SWORD2-Edit-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No SWORD2-Edit-IRI was given")
-        else:
-            conn_l.info("Complete deposit using the SWORD2-Edit-IRI %s" % se_iri)
-        
-        return self._make_request(target_iri = se_iri,
-                                  on_behalf_of=on_behalf_of,
-                                  in_progress='false',
-                                  method="POST",
-                                  empty=True,
-                                  request_type='SE_IRI Complete Deposit')
-
-    def update_files_for_resource(self, 
-                        payload,       # These need to be set to upload a file      
-                        filename,      # According to spec, "The client MUST supply a Content-Disposition header with a filename parameter 
-                                       #                     (note that this requires the filename be expressed in ASCII)."
-                        mimetype=None,
-                        packaging=None,
-                        
-                        edit_media_iri = None,
-                        
-                        on_behalf_of=None,
-                        in_progress=False, 
-                        metadata_relevant=False,
-                        # Pass back the deposit receipt to automatically get the right IRI to use
-                        dr = None
-                        ):
-        """
-Replacing the File Content of a Resource
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_editingcontent_binary
-
-The `Connection` can replace the file content of a resource, given the Edit-Media-IRI for this resource. This can be found
-from the `sword2.Deposit_Receipt.edit_media` attribute of a previous deposit, or directly from the deposit receipt XML response.
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set the `edit_media_iri` parameter to the Edit-Media-IRI.
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-
-Then, add in the payload:
--------------------------
-
-Set the following parameters in addition to the basic parameters (see `self.create_resource`):
-
-    `payload`   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-    `mimetype`  - MIMEType of the payload
-    `filename`  - filename. Most SWORD2 uploads have this as being mandatory.
-    `packaging` - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-                    
-    `metadata_relevant` - This should be set to `True` if the server should consider the file a potential source of metadata extraction, 
-                          or `False` if the server should not attempt to extract any metadata from the deposi
-
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-        """
-        if not edit_media_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the Edit-Media-IRI")
-                edit_media_iri = dr.edit_media
-                if edit_media_iri:
-                    conn_l.info("Update Resource via Edit-Media-IRI %s" % edit_media_iri)
-                else:
-                    raise Exception("No Edit-Media-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No Edit-Media-IRI was given")
-        else:
-            conn_l.info("Update Resource via Edit-Media-IRI %s" % edit_media_iri)
-            
-        return self._make_request(target_iri = edit_media_iri,
-                                  payload=payload,
-                                  mimetype=mimetype,
-                                  filename=filename,
-                                  in_progress=in_progress, 
-                                  packaging=packaging,
-                                  on_behalf_of=on_behalf_of,
-                                  method="PUT",
-                                  metadata_relevant=str(metadata_relevant),
-                                  request_type='EM_IRI PUT')
-
-    def update_metadata_for_resource(self, metadata_entry,    # required
-                                           edit_iri = None,
-                                           in_progress=False,
-                                           on_behalf_of=None,
-                                           dr = None
-                                           ):
-        """
-Replacing the Metadata of a Resource
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_editingcontent_metadata
-
-Replace the metadata of a resource as identified by its Edit-IRI. 
-
-Note, from the specification: "The client can only be sure that the server will support this process when using the default format supported by SWORD: Qualified Dublin Core XML embedded directly in the atom:entry. Other metadata formats MAY be supported by a particular server, but this is not covered by the SWORD profile"
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set the `edit_iri` parameter to the Edit-IRI.
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-
-Then, add in the metadata:
---------------------------
-
-Set the following in addition to the basic parameters:
-
-    `metadata_entry`  - An instance of `sword2.Entry`, set with the metadata required.
-    
-for example, to replace the metadata for a given:
-    # conn = `sword2.Connection`, edit_iri = Edit-IRI
-    
-    >>> from sword2 import Entry
-    >>> entry = Entry(title = "My new deposit",
-    ...               id = "new:id",    # atom:id
-    ...               dcterms_abstract = "My Thesis",
-    ...               dcterms_author = "Ben",
-    ...               dcterms_issued = "2010")
-    
-    >>> conn.update_metadata_for_resource(edit_iri = edit_iri,
-    ...                                   metadata_entry = entry)
-              
-
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-        """
-        if not edit_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the Edit-IRI")
-                edit_iri = dr.edit
-                if edit_iri:
-                    conn_l.info("Update Resource via Edit-IRI %s" % edit_iri)
-                else:
-                    raise Exception("No Edit-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No Edit-IRI was given")
-        else:
-            conn_l.info("Update Resource via Edit-IRI %s" % edit_iri)
-
-        return self._make_request(target_iri = edit_iri,
-                                  metadata_entry=metadata_entry,
-                                  on_behalf_of=on_behalf_of,
-                                  in_progress=in_progress, 
-                                  method="PUT",
-                                  request_type='Edit_IRI PUT')
-
-    def update_metadata_and_files_for_resource(self, metadata_entry,    # required
-                                                     payload,       # These need to be set to upload a file      
-                                                     filename,      # According to spec, "The client MUST supply a Content-Disposition header with a filename parameter 
-                                                                    #                     (note that this requires the filename be expressed in ASCII)."
-                                                     mimetype=None,
-                                                     packaging=None,
-                                                     
-                                                     edit_iri = None,
-                        
-                                                     metadata_relevant=False,
-                                                     in_progress=False,
-                                                     on_behalf_of=None,
-                                                     dr = None
-                                              ):
-        """
-Replacing the Metadata and Files of a Resource
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_editingcontent_multipart
-
-Replace the metadata and files of a resource as identified by its Edit-IRI. 
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set the `edit_iri` parameter to the Edit-IRI.
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-
-Then, add in the file and metadata information:
------------------------------------------------
-Set the following in addition to the basic parameters:
-
-File information:
-
-    `payload`   - the payload to send. Can be either a bytestring or a File-like object that supports `payload.read()`
-    `mimetype`  - MIMEType of the payload
-    `filename`  - filename. Most SWORD2 uploads have this as being mandatory.
-    `packaging` - the SWORD2 packaging type of the payload. 
-                    eg packaging = 'http://purl.org/net/sword/package/Binary'
-                    
-    `metadata_relevant` - This should be set to `True` if the server should consider the file a potential source of metadata extraction, 
-                          or `False` if the server should not attempt to extract any metadata from the deposi
-    
-Metadata information:
-
-    `metadata_entry`  - An instance of `sword2.Entry`, set with the metadata required.
-    
-for example, to create a metadata entry
-    >>> from sword2 import Entry
-    >>> entry = Entry(title = "My new deposit",
-    ...               id = "new:id",    # atom:id
-    ...               dcterms_abstract = "My Thesis",
-    ...               dcterms_author = "Ben",
-    ...               dcterms_issued = "2010")
-    
-Response:
-    
-A `sword2.Deposit_Receipt` object containing the deposit receipt data. If the response was blank or 
-not a Deposit Response, then only a few attributes will be populated:
-            
-    `code` -- HTTP code of the response
-    `response_headers`  -- `dict` of the reponse headers
-    `content`  --  (Optional) in case the response body is not empty but the response is not a Deposit Receipt
-        
-If exception-throwing is turned off (`error_response_raises_exceptions = False` or `self.raise_except = False`)
-then the response will be a `sword2.Error_Document`, but will still have the aforementioned attributes set, (code,
-response_headers, etc)
-        """
-        if not edit_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the Edit-IRI")
-                edit_iri = dr.edit
-                if edit_iri:
-                    conn_l.info("Update Resource via Edit-IRI %s" % edit_iri)
-                else:
-                    raise Exception("No Edit-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No Edit-IRI was given")
-        else:
-            conn_l.info("Update Resource via Edit-IRI %s" % edit_iri)
-
-        return self._make_request(target_iri = edit_iri,
-                                  metadata_entry=metadata_entry, 
-                                  payload=payload,
-                                  mimetype=mimetype,
-                                  filename=filename,
-                                  packaging=packaging,
-                                  on_behalf_of=on_behalf_of,
-                                  in_progress=in_progress,
-                                  metadata_relevant=str(metadata_relevant),
-                                  method="PUT",
-                                  request_type='Edit_IRI PUT')
-
-
-    def get_atom_sword_statement(self, sword_statement_iri):
-        """
-Getting the Sword Statement.
-
-IN PROGRESS - USE AT OWN RISK.... see `sword2.Sword_Statement`.
-        """
-        # get the statement first
-        conn_l.debug("Trying to GET the ATOM Sword Statement at %s." % sword_statement_iri)
-        response = self.get_resource(sword_statement_iri, headers = {'Accept':'application/atom+xml;type=feed'})
-        if response.code == 200:
-            #try:
-            if True:
-                conn_l.debug("Attempting to parse the response as a ATOM Sword Statement")
-                s = Sword_Statement(response.content)
-                conn_l.debug("Parsed SWORD2 Statement, returning")
-                return s
-            #except Exception, e:
-            #    # Any error here is to do with the parsing
-            #    return response.content
-
-    def get_resource(self, content_iri = None, 
-                           packaging=None, 
-                           on_behalf_of=None, 
-                           headers = {},
-                           dr = None):
-        """
-Retrieving the content
-
-Get the file or package from the SWORD2 server.
-
-From the specification:
-    "The Deposit Receipt contains two IRIs which can be used to retrieve content from the server: Cont-IRI and EM-IRI. These are provided in the atom:content@src element and the atom:link@rel="edit-media" elements respectively. Their only functional difference is that the client MUST NOT carry out any HTTP operations other than GET on the Cont-IRI, while all operations are permitted on the EM-IRI. It is acceptable, but not required, that both IRIs to be the same, and in this section we refer only to the EM-IRI but in all cases it can be substituted for the Cont-IRI."
-
-#BETASWORD2URL
-See http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#protocoloperations_retrievingcontent
-
-Usage:
-------
-
-Set the target for this request:
---------------------------------
-
-Set `content_iri` to be the Content-IRI for a given resource (or to the IRI of any resource you wish to HTTP GET)
-
-
-    OR 
-
-you can pass back the `sword2.Deposit_Receipt` object you got from a previous transaction as the `dr` parameter, 
-and the correct IRI will automatically be chosen.
-
-Response:
-    
-    A `ContentWrapper` - 
-        `ContentWrapper.response_headers`    -- response headers
-        `ContentWrapper.content` -- body of response from server (the file or package)
-        `ContentWrapper.code`    -- status code ('200' on success.)
-
-        """
-                
-        if not content_iri:
-            if dr != None:
-                conn_l.info("Using the deposit receipt to get the SWORD2-Edit-IRI")
-                content_iri = dr.cont_iri
-                if content_iri:
-                    conn_l.info("Getting the resource at Content-IRI %s" % content_iri)
-                else:
-                    raise Exception("No Content-IRI was given and no suitable IRI was found in the deposit receipt.")   
-            else:
-                raise Exception("No Content-IRI was given")
-        else:
-            conn_l.info("Getting the resource at Content-IRI %s" % content_iri)
-        
-        # 406 - PackagingFormatNotAvailable
-        if self.honour_receipts and packaging:
-            # Make sure that the packaging format is available from the deposit receipt, if loaded
-            conn_l.debug("Checking that the packaging format '%s' is available." % content_iri)
-            conn_l.debug("Cached Cont-IRI Receipts: %s" % self.cont_iris.keys())
-            if content_iri in self.cont_iris.keys():
-                if not (packaging in self.cont_iris[content_iri].packaging):
-                    conn_l.error("Desired packaging format '%' not available from the server, according to the deposit receipt. Change the client parameter 'honour_receipts' to False to avoid this check.")
-                    return self._return_error_or_exception(PackagingFormatNotAvailable, {}, "")
-        if on_behalf_of:
-            headers['On-Behalf-Of'] = self.on_behalf_of
-        elif self.on_behalf_of:
-            headers['On-Behalf-Of'] = self.on_behalf_of
-        if packaging:
-            headers['Accept-Packaging'] = packaging
-        
-        self._t.start("IRI GET resource")
-        if packaging:
-            conn_l.info("IRI GET resource '%s' with Accept-Packaging:%s" % (content_iri, packaging))
-        else:
-            conn_l.info("IRI GET resource '%s'" % content_iri)
-        resp, content = self.h.request(content_iri, "GET", headers=headers)
-        _, took_time = self._t.time_since_start("IRI GET resource")
-        if self.history:
-            self.history.log('Cont_IRI GET resource', 
-                             sd_iri = self.sd_iri,
-                             content_iri = content_iri,
-                             packaging = packaging,
-                             on_behalf_of = self.on_behalf_of,
-                             response = resp,
-                             headers = headers,
-                             process_duration = took_time)
-        conn_l.info("Server response: %s" % resp['status'])
-        conn_l.debug(resp)
-        if resp['status'] == '200':
-            conn_l.debug("Cont_IRI GET resource successful - got %s bytes from %s" % (len(content), content_iri))
-            class ContentWrapper(object):
-                def __init__(self, resp, content):
-                    self.response_headers = dict(resp)
-                    self.content = content
-                    self.code = resp.status
-            return ContentWrapper(resp, content)
-        elif resp['status'] == '408':   # Unavailable packaging format 
-            conn_l.error("Desired packaging format '%' not available from the server.")
-            return self._return_error_or_exception(PackagingFormatNotAvailable, resp, content)
-        else:
-            return self._handle_error_response(resp, content)
-
Binary file sword2-libraries-pyinstaller-compatible/sword2/connection.pyc has changed
--- a/sword2-libraries-pyinstaller-compatible/sword2/deposit_receipt.py.orig	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-This module provides `Deposit_Receipt`, a convenient class for extracting information from the Deposit Receipts sent back by the 
-SWORD2-compliant server for many transactions.
-
-#BETASWORD2URL
-See Section 10. Deposit Receipt: http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#depositreceipt
-
-"""
-
-from sword2_logging import logging
-d_l = logging.getLogger(__name__)
-
-from atom_objects import Category
-
-from compatible_libs import etree
-from utils import NS, get_text
-
-class Deposit_Receipt(object):
-    def __init__(self, xml_deposit_receipt=None, dom=None, response_headers={}, location=None, code=0):
-        """
-`Deposit_Receipt` - provides convenience methods for extracting information from the Deposit Receipts sent back by the 
-SWORD2-compliant server for many transactions.
-
-#BETASWORD2URL
-See Section 10. Deposit Receipt: http://sword-app.svn.sourceforge.net/viewvc/sword-app/spec/trunk/SWORDProfile.html?revision=HEAD#depositreceipt
-
-Transactions carried out by `sword2.Connection` will return a `Deposit_Receipt` object, if a deposit receipt document is sent back by the server.
-
-Usage:
-    
->>> from sword2 import Deposit_Receipt
-
-.... get the XML text for a Deposit Receipt in the variable `doc`
-
-# Parse the response:
->>> dr = Deposit_Receipt(xml_deposit_receipt = doc)
-
-# Check that the response is parsable (valid XML) and is SWORD2-compliant
->>> assert dr.parsed == True
->>> assert dr.valid == True
-
-Availible attributes:
-    
-    Atom convenience attribs -- corresponds to (type of object that is held)
-    `self.title`            -- <atom:title>   (`str`)
-    `self.id`               -- <id>           (`str`)
-    `self.updated`          -- <updated>      (`str`)
-    `self.summary`          -- <atom:summary> (`str`)
-    `self.categories`       -- <category>     (`list` of `sword2.Category`)
-        
-    IRI/URIs
-    `self.edit`             -- The Edit-IRI         (`str`)
-                                <link rel="edit">
-    `self.edit_media`       -- The Edit-Media-IRI   (`str`)
-                                <link rel="edit-media">
-    `self.edit_media_feed`  -- The Edit-Media-IRI [Atom Feed]  (`str`)
-                                <link rel="edit-media" type="application/atom+xml;type=feed">
-    `self.alternate`        -- A link which, according to the spec,                     (`str`)
-                               "points to the splash page of the item on the server"
-    `self.se_iri`           -- The SWORD2 Edit IRI (SE-IRI), defined by                 (`str`)
-                                <link rel="http://purl.org/net/sword/terms/add"> 
-                                which MAY be the same as the Edit-IRI
-
-    `self.cont_iri`         -- The Content-IRI     (`str`)
-                                eg `src` from <content type="application/zip" src="http://swordapp.org/cont-IRI/43/my_deposit"/>
-    `self.content`          -- All Content-IRIs    (`dict` with the src or Content-IRI as the key, with a `dict` of the other attributes as its value
-    
-    `self.links`            -- All links elements in a `dict`, with the 'rel' value being used as its key. The values of this are `list`s 
-                                with a `dict` of attributes for each item, corresponding to the information in a single <link> element.
-                                
-                                SWORD2 links for "http://purl.org/net/sword/terms/originalDeposit" and "http://purl.org.net/sword/terms/derivedResource"
-                                are to be found in `self.links`
-                                
-                                eg
-                                >>> dr.links.get("http://purl.org.net/sword/terms/derivedResource")
-                                {'href': "....", 'type':'application/pdf'}
-    
-
-    General metadata:
-    `self.metadata`         -- Simple metadata access. 
-                                A `dict` where the keys are equivalent to the prefixed element names, with an underscore(_) replacing the colon (:)
-                                eg "<dcterms:title>" in the deposit receipt would be accessible in this attribute, under
-                                the key of 'dcterms_title'
-                                
-                                eg
-                                >>> dr.metadata.get("dcterms_title")
-                                "The Origin of Species"
-                                
-                                >>> dr.metadata.get("dcterms_madeupelement")
-                                `None`
-    
-    `self.packaging`        -- sword:packaging elements declaring the formats that the Media Resource can be retrieved in   (`list` of `str`)
-    
-    `self.response_headers` -- The HTTP response headers that accompanied this receipt
-    
-    `self.location`         -- The location, if given (from HTTP Header: "Location: ....")
-    """
-        self.parsed = False
-        self.response_headers=response_headers
-        self.location = location
-        self.content = None
-        self.code = code
-        self.metadata = {}
-        self.links = {}
-        self.edit = None
-        self.edit_media = None
-        self.edit_media_feed = None
-        self.alternate = None
-        self.se_iri = None 
-        # Atom convenience attribs
-        self.title = None
-        self.id = None
-        self.updated = None
-        self.summary = None
-        
-        self.packaging = []
-        self.categories = []
-        self.content = {}
-        self.cont_iri = None
-        
-        if xml_deposit_receipt:
-            try:
-                self.dom = etree.fromstring(xml_deposit_receipt)
-                self.parsed = True
-            except Exception, e:
-                d_l.error("Was not able to parse the deposit receipt as XML.")
-                return
-            self.handle_metadata()
-        elif dom != None:
-            self.dom = dom
-            self.parsed = True
-            self.handle_metadata()
-    
-    def handle_metadata(self):
-        """Method that walks the `etree.SubElement`, assigning the information to the objects attributes."""
-        for e in self.dom.getchildren():
-            for nmsp, prefix in NS.iteritems():
-                if str(e.tag).startswith(prefix % ""):
-                    _, tagname = e.tag.rsplit("}", 1)
-                    field = "%s_%s" % (nmsp, tagname)
-                    d_l.debug("Attempting to intepret field: '%s'" % field)
-                    if field == "atom_link":
-                        self.handle_link(e)
-                    elif field == "atom_content":
-                        self.handle_content(e)
-                    elif field == "atom_generator":
-                        for ak,av in e.attrib.iteritems():
-                            if not e.text:
-                                e.text = ""
-                            e.text += " %s:\"%s\"" % (ak, av)
-                        self.metadata[field] = e.text.strip()
-                    elif field == "sword_packaging":
-                        self.packaging.append(e.text)
-                    else:
-                        if field == "atom_title":
-                            self.title = e.text
-                        if field == "atom_id":
-                            self.id = e.text
-                        if field == "atom_updated":
-                            self.updated = e.text
-                        if field == "atom_summary":
-                            self.summary = e.text
-                        if field == "atom_category":
-                            self.categories.append(Category(dom=e))
-                        if self.metadata.has_key(field):
-                            if isinstance(self.metadata[field], list):
-                                self.metadata[field].append(e.text)
-                            else:
-                                self.metadata[field] = [self.metadata[field], e.text]
-                        else:
-                            self.metadata[field] = e.text
-                    
-    def handle_link(self, e):
-        """Method that handles the intepreting of <atom:link> element information and placing it into the anticipated attributes."""
-        # MUST have rel
-        rel = e.attrib.get('rel', None)
-        if rel:
-            if rel == "edit":
-                self.edit = e.attrib.get('href', None)
-            elif rel == "edit-media":
-                # only put the edit-media iri in the convenience attribute if
-                # there is no 'type'
-                if not ('type' in e.attrib.keys()):
-                    self.edit_media = e.attrib.get('href', None)
-                elif e.attrib['type'] == "application/atom+xml; type=feed":
-                    self.edit_media_feed = e.attrib.get('href', None)
-            elif rel == "http://purl.org/net/sword/terms/add":
-                self.se_iri = e.attrib.get('href', None)
-            elif rel == "alternate":
-                self.alternate = e.attrib.get('href', None)
-            # Put all links into .links attribute, with all element attribs
-            attribs = {}
-            for k,v in e.attrib.iteritems():
-                if k != "rel":
-                    attribs[k] = v
-            if self.links.has_key(rel): 
-                self.links[rel].append(attribs)
-            else:
-                self.links[rel] = [attribs]            
-            
-        
-    def handle_content(self, e):
-        """Method to intepret the <atom:content> elements."""
-        # eg <content type="application/zip" src="http://swordapp.org/cont-IRI/43/my_deposit"/>
-        if e.attrib.has_key("src"):
-            src = e.attrib['src']
-            info = dict(e.attrib).copy()
-            del info['src']
-            self.content[src] = info
-            self.cont_iri = src
-            
-    def to_xml(self):
-        """Convenience method for outputing the DOM as a (byte)string."""
-        return etree.tostring(self.dom)
-    
-    def __str__(self):
-        """Method for producing a human-readable report about the information in this object, suitable
-        for CLI or other logging.
-        
-        NB does not report all information, just key parts."""
-        _s = []
-        for k in sorted(self.metadata.keys()):
-            _s.append("%s: '%s'" % (k, self.metadata[k]))
-        if self.edit:
-            _s.append("Edit IRI: %s" % self.edit)
-        if self.edit_media:
-            _s.append("Edit-Media IRI: %s" % self.edit_media)
-        if self.se_iri:
-            _s.append("SWORD2 Add IRI: %s" % self.se_iri)
-        for c in self.categories:
-            _s.append(str(c))
-        if self.packaging:
-            _s.append("SWORD2 Package formats available: %s" % self.packaging)
-        if self.alternate:
-            _s.append("Alternate IRI: %s" % self.alternate)
-        for k, v in self.links.iteritems():
-            _s.append("Link rel:'%s' -- %s" % (k, v))
-        return "\n".join(_s)
Binary file sword2-libraries-pyinstaller-compatible/sword2/deposit_receipt.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/error_document.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/exceptions.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/implementation_info.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/server_errors.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/service_document.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/sword2_logging.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/transaction_history.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/sword2/utils.pyc has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/.DS_Store has changed
--- a/sword2-libraries-pyinstaller-compatible/tests/.cache/c4dm.eecs.qmul.ac.uk,smdmrd-test,swordv2,servicedocument,48aa9f2607a9f6cdddd8639620add899	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-status: 200
-content-location: http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument
-server: Apache-Coyote/1.1
-date: Thu, 29 Mar 2012 14:32:04 GMT
-content-type: application/atomserv+xml
-
-<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"><workspace><atom:title type="text">Sustainable Management Of Digital Music Research Data</atom:title><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/80"><atom:title type="text">Automatic Music Transcription Datasets</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">NON-EXCLUSIVE DISTRIBUTION LICENSE
-
-By signing and submitting this license, you (the author(s) or copyright
-owner) grants to DSpace@C4DM the non-exclusive right to reproduce,
-translate (as defined below), and/or distribute your submission (including
-the abstract) worldwide in print and electronic format and in any medium,
-including but not limited to audio or video.
-
-You agree that DSpace@C4DM may, without changing the content, translate the
-submission to any medium or format for the purpose of preservation.
-
-You also agree that DSpace@C4DM may keep more than one copy of this submission for
-purposes of security, back-up and preservation.
-
-You represent that the submission is your original work, and that you have
-the right to grant the rights contained in this license. You also represent
-that your submission does not, to the best of your knowledge, infringe upon
-anyone's copyright.
-
-If the submission contains material for which you do not hold copyright,
-you represent that you have obtained the unrestricted permission of the
-copyright owner to grant DSU the rights required by this license, and that
-such third-party owned material is clearly identified and acknowledged
-within the text or content of the submission.
-
-IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED
-BY AN AGENCY OR ORGANIZATION OTHER THAN DSpace@C4DM, YOU REPRESENT THAT YOU HAVE
-FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH
-CONTRACT OR AGREEMENT.
-
-DSpace@C4DM will clearly identify your name(s) as the author(s) or owner(s) of the
-submission, and will not make any alteration, other than as allowed by this
-license, to your submission.
-</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging><abstract xmlns="http://purl.org/dc/terms/">Datasets used for automatic music transcription research</abstract></collection><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/98"><atom:title type="text">Bioacoustics datasets</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">NON-EXCLUSIVE DISTRIBUTION LICENSE
-
-By signing and submitting this license, you (the author(s) or copyright
-owner) grants to DSpace@C4DM the non-exclusive right to reproduce,
-translate (as defined below), and/or distribute your submission (including
-the abstract) worldwide in print and electronic format and in any medium,
-including but not limited to audio or video.
-
-You agree that DSpace@C4DM may, without changing the content, translate the
-submission to any medium or format for the purpose of preservation.
-
-You also agree that DSpace@C4DM may keep more than one copy of this submission for
-purposes of security, back-up and preservation.
-
-You represent that the submission is your original work, and that you have
-the right to grant the rights contained in this license. You also represent
-that your submission does not, to the best of your knowledge, infringe upon
-anyone's copyright.
-
-If the submission contains material for which you do not hold copyright,
-you represent that you have obtained the unrestricted permission of the
-copyright owner to grant DSU the rights required by this license, and that
-such third-party owned material is clearly identified and acknowledged
-within the text or content of the submission.
-
-IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED
-BY AN AGENCY OR ORGANIZATION OTHER THAN DSpace@C4DM, YOU REPRESENT THAT YOU HAVE
-FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH
-CONTRACT OR AGREEMENT.
-
-DSpace@C4DM will clearly identify your name(s) as the author(s) or owner(s) of the
-submission, and will not make any alteration, other than as allowed by this
-license, to your submission.
-</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging></collection><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/96"><atom:title type="text">Mutitrack Test</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">Many tracks</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging><abstract xmlns="http://purl.org/dc/terms/">Many tracks</abstract></collection><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/101"><atom:title type="text">SJW001</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">NON-EXCLUSIVE DISTRIBUTION LICENSE
-
-By signing and submitting this license, you (the author(s) or copyright
-owner) grants to DSpace@C4DM the non-exclusive right to reproduce,
-translate (as defined below), and/or distribute your submission (including
-the abstract) worldwide in print and electronic format and in any medium,
-including but not limited to audio or video.
-
-You agree that DSpace@C4DM may, without changing the content, translate the
-submission to any medium or format for the purpose of preservation.
-
-You also agree that DSpace@C4DM may keep more than one copy of this submission for
-purposes of security, back-up and preservation.
-
-You represent that the submission is your original work, and that you have
-the right to grant the rights contained in this license. You also represent
-that your submission does not, to the best of your knowledge, infringe upon
-anyone's copyright.
-
-If the submission contains material for which you do not hold copyright,
-you represent that you have obtained the unrestricted permission of the
-copyright owner to grant DSU the rights required by this license, and that
-such third-party owned material is clearly identified and acknowledged
-within the text or content of the submission.
-
-IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED
-BY AN AGENCY OR ORGANIZATION OTHER THAN DSpace@C4DM, YOU REPRESENT THAT YOU HAVE
-FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH
-CONTRACT OR AGREEMENT.
-
-DSpace@C4DM will clearly identify your name(s) as the author(s) or owner(s) of the
-submission, and will not make any alteration, other than as allowed by this
-license, to your submission.
-</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging><abstract xmlns="http://purl.org/dc/terms/">SJW1</abstract></collection><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/149"><atom:title type="text">SWORD Test collection</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">NON-EXCLUSIVE DISTRIBUTION LICENSE
-
-By signing and submitting this license, you (the author(s) or copyright
-owner) grants to DSpace@C4DM the non-exclusive right to reproduce,
-translate (as defined below), and/or distribute your submission (including
-the abstract) worldwide in print and electronic format and in any medium,
-including but not limited to audio or video.
-
-You agree that DSpace@C4DM may, without changing the content, translate the
-submission to any medium or format for the purpose of preservation.
-
-You also agree that DSpace@C4DM may keep more than one copy of this submission for
-purposes of security, back-up and preservation.
-
-You represent that the submission is your original work, and that you have
-the right to grant the rights contained in this license. You also represent
-that your submission does not, to the best of your knowledge, infringe upon
-anyone's copyright.
-
-If the submission contains material for which you do not hold copyright,
-you represent that you have obtained the unrestricted permission of the
-copyright owner to grant DSU the rights required by this license, and that
-such third-party owned material is clearly identified and acknowledged
-within the text or content of the submission.
-
-IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED
-BY AN AGENCY OR ORGANIZATION OTHER THAN DSpace@C4DM, YOU REPRESENT THAT YOU HAVE
-FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH
-CONTRACT OR AGREEMENT.
-
-DSpace@C4DM will clearly identify your name(s) as the author(s) or owner(s) of the
-submission, and will not make any alteration, other than as allowed by this
-license, to your submission.
-</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging><abstract xmlns="http://purl.org/dc/terms/">Test</abstract></collection><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/155"><atom:title type="text">SWORD with Workflow</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">NON-EXCLUSIVE DISTRIBUTION LICENSE
-
-By signing and submitting this license, you (the author(s) or copyright
-owner) grants to DSpace@C4DM the non-exclusive right to reproduce,
-translate (as defined below), and/or distribute your submission (including
-the abstract) worldwide in print and electronic format and in any medium,
-including but not limited to audio or video.
-
-You agree that DSpace@C4DM may, without changing the content, translate the
-submission to any medium or format for the purpose of preservation.
-
-You also agree that DSpace@C4DM may keep more than one copy of this submission for
-purposes of security, back-up and preservation.
-
-You represent that the submission is your original work, and that you have
-the right to grant the rights contained in this license. You also represent
-that your submission does not, to the best of your knowledge, infringe upon
-anyone's copyright.
-
-If the submission contains material for which you do not hold copyright,
-you represent that you have obtained the unrestricted permission of the
-copyright owner to grant DSU the rights required by this license, and that
-such third-party owned material is clearly identified and acknowledged
-within the text or content of the submission.
-
-IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED
-BY AN AGENCY OR ORGANIZATION OTHER THAN DSpace@C4DM, YOU REPRESENT THAT YOU HAVE
-FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH
-CONTRACT OR AGREEMENT.
-
-DSpace@C4DM will clearly identify your name(s) as the author(s) or owner(s) of the
-submission, and will not make any alteration, other than as allowed by this
-license, to your submission.
-</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging></collection><collection href="http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/collection/123456789/95"><atom:title type="text">Test community 1</atom:title><accept>application/zip</accept><accept>application/pdf</accept><accept>image/jpeg</accept><accept>audio/x-wav</accept><accept>audio/midi</accept><accept>audio/mpeg</accept><accept alternate="multipart/related">application/zip</accept><accept alternate="multipart/related">application/pdf</accept><accept alternate="multipart/related">image/jpeg</accept><accept alternate="multipart/related">audio/x-wav</accept><accept alternate="multipart/related">audio/midi</accept><accept alternate="multipart/related">audio/mpeg</accept><collectionPolicy xmlns="http://purl.org/net/sword/terms/">NON-EXCLUSIVE DISTRIBUTION LICENSE
-
-By signing and submitting this license, you (the author(s) or copyright
-owner) grants to DSpace@C4DM the non-exclusive right to reproduce,
-translate (as defined below), and/or distribute your submission (including
-the abstract) worldwide in print and electronic format and in any medium,
-including but not limited to audio or video.
-
-You agree that DSpace@C4DM may, without changing the content, translate the
-submission to any medium or format for the purpose of preservation.
-
-You also agree that DSpace@C4DM may keep more than one copy of this submission for
-purposes of security, back-up and preservation.
-
-You represent that the submission is your original work, and that you have
-the right to grant the rights contained in this license. You also represent
-that your submission does not, to the best of your knowledge, infringe upon
-anyone's copyright.
-
-If the submission contains material for which you do not hold copyright,
-you represent that you have obtained the unrestricted permission of the
-copyright owner to grant DSU the rights required by this license, and that
-such third-party owned material is clearly identified and acknowledged
-within the text or content of the submission.
-
-IF THE SUBMISSION IS BASED UPON WORK THAT HAS BEEN SPONSORED OR SUPPORTED
-BY AN AGENCY OR ORGANIZATION OTHER THAN DSpace@C4DM, YOU REPRESENT THAT YOU HAVE
-FULFILLED ANY RIGHT OF REVIEW OR OTHER OBLIGATIONS REQUIRED BY SUCH
-CONTRACT OR AGREEMENT.
-
-DSpace@C4DM will clearly identify your name(s) as the author(s) or owner(s) of the
-submission, and will not make any alteration, other than as allowed by this
-license, to your submission.
-</collectionPolicy><mediation xmlns="http://purl.org/net/sword/terms/">true</mediation><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/SimpleZip</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/METSDSpaceSIP</acceptPackaging><acceptPackaging xmlns="http://purl.org/net/sword/terms/">http://purl.org/net/sword/package/Binary</acceptPackaging></collection></workspace><generator xmlns="http://www.w3.org/2005/Atom" uri="http://www.dspace.org/ns/sword/2.0/" version="2.0">rdm.c4dm@gmail.com</generator><version xmlns="http://purl.org/net/sword/terms/">2.0</version></service>
\ No newline at end of file
--- a/sword2-libraries-pyinstaller-compatible/tests/LICENSE.txt	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-Copyright (c) 2011 Ben O'Steen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file sword2-libraries-pyinstaller-compatible/tests/PDF1.pdf has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/PDF2.pdf has changed
--- a/sword2-libraries-pyinstaller-compatible/tests/README	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-Testsuite
----------
-
-functional: 
-
-    Contains tests that test only the functional methods and classes in the sword2 module. Requires no external SWORD2 server to be available.
-
-    (It is suggested that these are tested as a pre-commit hook - there is an example script in .hooks/precommit.sh to do this.)
-
-http:
-    Contains tests that require the presence of SWORD2 servers. Currently, this is limited to the Simple Sword Server (sss.py) from the sword-app project.
Binary file sword2-libraries-pyinstaller-compatible/tests/bagitexample.zip has changed
--- a/sword2-libraries-pyinstaller-compatible/tests/c4dmprompt.py	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-from sword2 import *
-
-testentry = 'd'; # 'd' for metadata + data
-c = Connection("http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument", user_name="marco.fabiani@eecs.qmul.ac.uk", user_pass="housecouch29",keep_history=False)
-
-c.get_service_document()
-
-if c.sd != None:
-	#c.sd.parsed
-	#c.sd.valid
-	#print c.history
-	print "Welcome to the ",c.workspaces[0][0], "repository"
-	print "Available Collections: "
-	numColl = len(c.workspaces[0][1])
-	for ctr in range(numColl):
-		coll = c.workspaces[0][1][ctr]
-		print ctr+1,":",coll.title
-		#print coll.description
-		#print "URI: ",coll.href
-		#print "Accepted types: ",coll.accept
-		#print "---------------------------"
-	sel = -1
-	while (sel<=0 or sel>numColl):
-		sel = input("Select a Collection: ")
-	collection = c.workspaces[0][1][sel-1]
-	print "You selected: "
-	print "Name: ",collection.title
-	print collection.description
-	print "URI: ",collection.href
-	print "Accepted types: ",collection.accept
-	
-	if testentry == 'd':
-		# create a metadata + files entry
-		entry = Entry(dcterms_title = "Another Two PFDs deposit", dcterms_abstract = "My Thesis", dcterms_created = "2009",dcterms_creator="Fabiani, Marco",dcterms_publisher="C4DM",dcterms_type="Dataset",dcterms_subject="test",dcterms_isReferencedBy="Myself (2009). Another test deposit.")
-		entry.add_fields(dcterms_creator="Pallino, Pinco")
-		print str(entry)
-		
-		receipt = c.create(col_iri = collection.href, metadata_entry = entry)
-		
-		
-		
-		# HERE GOES BITSTREAM UPLOAD!
-		print receipt.edit_media_feed
-		#print receipt.se_iri
-		#print receipt
-		myfile = open("PDF1.pdf", "rb")
-		try:
-			receipt_dep = c.add_file_to_resource(edit_media_iri = receipt.edit_media,
-				payload = myfile,
-				filename = 'PDF1.pdf',
-				mimetype = 'application/zip',
-				packaging = 'http://purl.org/net/sword/package/Binary'
-				#packaging = 'http://purl.org/net/sword/package/SimpleZip')
-				)
-		except HTTPResponseError:
-			print "Bad request"	
-		myfile.close()	
-		
-		myfile = open("PDF2.pdf", "rb")
-		try:
-			receipt_dep = c.add_file_to_resource(edit_media_iri = receipt.edit_media,
-				payload = myfile,
-				filename = 'PDF2.pdf',
-				mimetype = 'application/zip',
-				packaging = 'http://purl.org/net/sword/package/Binary'
-				#packaging = 'http://purl.org/net/sword/package/SimpleZip')
-				)
-		except HTTPResponseError:
-			print "Bad request"	
-		myfile.close()
-		try:
-			dr = c.complete_deposit(se_iri = receipt.se_iri)
-		except ServerError:
-			print "Server error!"
-		
-		#entry.register_namespace("simpledc","http://purl.org/dc/terms/")
-		
-		#entry.add_fields(simpledc_contributor="Marco",simpledc_title="Test title 1" ,simpledc_creator="myself",simpledc_description="A description")
-		
-		#entry.register_namespace("mo","http://purl.org/ontology/mo/")
-		
-		#entry.add_fields(mo_track="testtrack")
-		
-		
-		#e = Entry(title="Foo", id="asidjasidj", dcterms_abstract="abstract", dcterms_title="my title 1")
-		
-		#with open("foo.zip","rb") as pkg:
-		#        receipt = c.create(col_iri = c.sd.workspaces[0][1][1].href,metadata_entry = e,payload=pkg,mimetype="application/zip", filename="foo.zip", packaging = 'http://purl.org/net/sword/package/Binary',in_progress = True)
-							
-		#    assert receipt.code == 201
-		#    assert receipt.location != None
-			
-			# these last two assertions are contingent on if we actually get a 
-			# receipt back from the server (which we might not legitimately get)
-			#assert receipt.dom is None or receipt.parsed == True
-			#assert receipt.dom is None or receipt.valid == True
-		
-		
-		#print entry
-		
-		#data = open("foo.pdf", "rb")
-		
-		#receipt = c.create(col_iri = w[1][0].href, metadata_entry = entry,payload = data, mimetype = "application/pdf",packaging = "http://purl.org/net/sword/package/Binary")
-		#try:
-			##receipt = c.create(col_iri = c.sd.workspaces[0][1][1].href, payload = data, mimetype = "application/zip",filename="example.zip", packaging = "http://purl.org/net/sword/package/METSDSpaceSIP")
-			#receipt = c.create(col_iri = c.sd.workspaces[0][1][1].href, metadata_entry = entry)
-			#receipt = c.create(col_iri = w[1][0].href, metadata_entry = entry,payload = data, mimetype = "application/pdf",packaging = "http://purl.org/net/sword/package/Binary",filename="foo.pdf")
-		#except ServerError:
-			#print "Server error!"
-		#except HTTPResponseError:
-			#print "Bad request"
-			
-		#try:#data=("foo.zip","rb")
-		#	deposit_receipt = c.append(dr=receipt,payload="hello",filename="foo.txt",packaging = "http://purl.org/net/sword/package/Binary",mimetype = "text/plain")
-		#except HTTPResponseError:
-		#	print "Bad request"
-			
-		#try:
-		#	dr = c.complete_deposit(se_iri = receipt.se_iri)
-		#except ServerError:
-		#	print "Server error!"
-	#else:
-		#print "Couldn't retrieve SD"
-	elif testentry == 'm':
-	# create a metadata + files entry
-		#entry = Entry(dcterms_title = "Test Mets", dcterms_abstract = "My Thesis", dcterms_created = "2009",dcterms_creator="Fabiani, Marco",dcterms_publisher="C4DM",dcterms_type="Dataset",dcterms_subject="test",dcterms_isReferencedBy="Myself (2009). Another test deposit.")
-	#	entry.add_fields(dcterms_creator="Pallino, Pinco")
-	#	print str(entry)
-		
-		#receipt = c.create(col_iri = collection.href, metadata_entry = entry)	
-		# HERE GOES BITSTREAM UPLOAD!
-		#print receipt.edit_media_feed
-		# Send a DSPACE mets package
-		myfile = open("example.zip", "rb")
-		try:
-		#	receipt_dep = c.update(dr = receipt,
-		#	receipt_dep = c.add_file_to_resource(edit_media_iri = receipt.edit_media,
-			receipt_dep = c.create(col_iri = collection.href,
-			payload = myfile,
-			filename = 'example.zip',
-			mimetype = 'application/zip',
-			packaging = 'http://purl.org/net/sword/package/METSDSpaceSIP')
-			#in_progress = True)
-			receipt = receipt_dep
-		except:
-			print "Error!"
-		myfile.close()
-	else:
-	# create a metadata + files entry
-		#entry = Entry(dcterms_title = "Test Mets", dcterms_abstract = "My Thesis", dcterms_created = "2009",dcterms_creator="Fabiani, Marco",dcterms_publisher="C4DM",dcterms_type="Dataset",dcterms_subject="test",dcterms_isReferencedBy="Myself (2009). Another test deposit.")
-	#	entry.add_fields(dcterms_creator="Pallino, Pinco")
-	#	print str(entry)
-		
-		#receipt = c.create(col_iri = collection.href, metadata_entry = entry)	
-		# HERE GOES BITSTREAM UPLOAD!
-		#print receipt.edit_media_feed
-		# Send a DSPACE mets package
-		myfile = open("pdfs.zip", "rb")
-		try:
-		#	receipt_dep = c.update(dr = receipt,
-		#	receipt_dep = c.add_file_to_resource(edit_media_iri = receipt.edit_media,
-			receipt_dep = c.create(col_iri = collection.href,
-			payload = myfile,
-			filename = 'pdfs.zip',
-			mimetype = 'application/zip',
-			packaging = 'http://purl.org/net/sword/package/SimpleZip')
-			#in_progress = True)
-			receipt = receipt_dep
-		except:
-			print "Error!"
-		myfile.close()
-		
-		entry = Entry(dcterms_title = "Test Simple zip 343", dcterms_abstract = "abstract", dcterms_created = "2009",dcterms_creator="Fabiani, Marco",dcterms_publisher="C4DM",dcterms_type="Dataset",dcterms_subject="test",dcterms_isReferencedBy="Myself (2009). Another test deposit.")
-		
-		receipt_update = c.update(dr = receipt_dep , metadata_entry = entry, in_progress = True)
-	#try:
-	#	dr = c.complete_deposit(se_iri = receipt.se_iri)
-	#except ServerError:
-	#	print "Server error!"
-	
-	
-	
-	
--- a/sword2-libraries-pyinstaller-compatible/tests/c4dmsword.py	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-from sword2 import *
-
-c = Connection("http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument", user_name="marco.fabiani@eecs.qmul.ac.uk", user_pass="housecouch29",keep_history=False)
-
-c.get_service_document()
-
-if c.sd != None:
-	#c.sd.parsed
-	#c.sd.valid
-	#print c.history
-
-	print "Available collections"
-
-	for w in c.workspaces:
-		#print w
-		print "Community: ",w[1]
-		print "*---------------------------*"
-		print "Collections: "
-		for collection in w[1]:
-			print "Name: ",collection.title
-			print collection.description
-			print "URI: ",collection.href
-			print "Accepted types: ",collection.accept
-			print "---------------------------"
-	# create an entry
-	#entry = Entry(title = "My new deposit 1", id = "foo:id", dcterms_abstract = "My Thesis", dcterms_author = "Me", dcterms_issued = "2009")
-	
-	#entry.register_namespace("simpledc","http://purl.org/dc/terms/")
-	
-	#entry.add_fields(simpledc_contributor="Marco",simpledc_title="Test title 1" ,simpledc_creator="myself",simpledc_description="A description")
-	
-	#entry.register_namespace("mo","http://purl.org/ontology/mo/")
-	
-	#entry.add_fields(mo_track="testtrack")
-	
-	
-	e = Entry(title="Foo", id="asidjasidj", dcterms_abstract="abstract", dcterms_title="my title 1")
-	
-	#with open("foo.zip","rb") as pkg:
-    #        receipt = c.create(col_iri = c.sd.workspaces[0][1][1].href,metadata_entry = e,payload=pkg,mimetype="application/zip", filename="foo.zip", packaging = 'http://purl.org/net/sword/package/Binary',in_progress = True)
-                        
-    #    assert receipt.code == 201
-    #    assert receipt.location != None
-        
-        # these last two assertions are contingent on if we actually get a 
-        # receipt back from the server (which we might not legitimately get)
-        #assert receipt.dom is None or receipt.parsed == True
-        #assert receipt.dom is None or receipt.valid == True
-	
-	
-	#print entry
-	
-	#data = open("foo.pdf", "rb")
-	
-	receipt = c.create(col_iri = w[1][0].href, metadata_entry = entry,payload = data, mimetype = "application/pdf",packaging = "http://purl.org/net/sword/package/Binary")
-	#try:
-		##receipt = c.create(col_iri = c.sd.workspaces[0][1][1].href, payload = data, mimetype = "application/zip",filename="example.zip", packaging = "http://purl.org/net/sword/package/METSDSpaceSIP")
-		#receipt = c.create(col_iri = c.sd.workspaces[0][1][1].href, metadata_entry = entry)
-		#receipt = c.create(col_iri = w[1][0].href, metadata_entry = entry,payload = data, mimetype = "application/pdf",packaging = "http://purl.org/net/sword/package/Binary",filename="foo.pdf")
-	#except ServerError:
-		#print "Server error!"
-	#except HTTPResponseError:
-		#print "Bad request"
-		
-	try:#data=("foo.zip","rb")
-		deposit_receipt = c.append(dr=receipt,payload="hello",filename="foo.txt",packaging = "http://purl.org/net/sword/package/Binary",mimetype = "text/plain")
-	except HTTPResponseError:
-		print "Bad request"
-		
-	try:
-		dr = c.complete_deposit(se_iri = receipt.se_iri)
-	except ServerError:
-		print "Server error!"
-else:
-	print "Couldn't retrieve SD"
-
-
-
-
--- a/sword2-libraries-pyinstaller-compatible/tests/dspaceuploader.py	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-#!usr/bin/env/ python
-# sworduploader.py
-# Copyright: Marco Fabiani, Centre for Digital Music, Queen Mary University of London
-# License: XXXXXX
-
-import argparse, getpass, zipfile,os,sys
-from sword2 import *
-
-# Parse arguments
-parser = argparse.ArgumentParser(description="Bulk upload to DSpace using SWORDv2.",epilog="If the submission is created successfully, it will remain open to be completed with the necessary metadata and licenses, using the DSpace web interface. The submission can be found in the \"My Account -> Submissions\" section of the user's area.")
-parser.add_argument("data", type=str, nargs=1,
-                   help="Accepts: METSDSpaceSIP packages, zip files, directories, single files")
-parser.add_argument("--username", dest="user_name", type=str,nargs=1, help="DSpace username.")
-parser.add_argument("--title", dest="title", type=str,nargs=1, help="Title (ignored for METS packages).")
-parser.add_argument("--author", dest="author", type=str,nargs="+", help="Author(s) (ignored for METS packages). Accepts multiple entries in the format \"Surname, Name\"")
-parser.add_argument("--date", dest="date", type=str,nargs=1, help="Date of creation (string) (ignored for METS packages).")
-parser.add_argument("--servicedoc", dest="dspaceurl", type=str,nargs=1, help="Url of the SWORDv2 service document (default: c4dm).")
-
-args = parser.parse_args()
-data = args.data[0]
-if args.dspaceurl == None:
-	dspaceurl = "http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument"
-else:
-	dspaceurl = args.dspaceurl[0]
-
-
-try:
-	# Connect to SWORD server
-	attempts = 3 #  Number of attempts left to connect to server
-	connected = False
-	while attempts>0 and not connected:
-		print "Connecting to SWORD server. Remaining attempts: ", attempts
-		# Try to login, get service document
-		# Get username and password
-		if args.user_name == None:
-			user_name = raw_input("DSpace Username: ")
-		else:
-			user_name = args.user_name[0]
-			print "DSpace Username: ",user_name
-		user_pass = getpass.getpass("DSpace password:")
-		# Connect to the server
-		c = Connection(dspaceurl, user_name=user_name, user_pass=user_pass,keep_history=False)
-		# Get service document
-		try:
-			c.get_service_document()
-		except: # Could be Forbidden if the exception was raised
-			attempts-=1
-			print "Incorrect username and/or password"
-		if c.sd != None:
-			connected = True
-			
-	if connected:
-		# List available collections
-		print "------------------------"
-		print "Welcome to the ",c.workspaces[0][0], "repository"
-		print "Available Collections: "
-		numColl = len(c.workspaces[0][1])
-		for ctr in range(numColl):
-			coll = c.workspaces[0][1][ctr]
-			print ctr+1,":",coll.title
-		# Select a collection to deposit into
-		sel = -1
-		while (sel<=0 or sel>numColl):
-			sel = input("Select a Collection to submit your files into: ")
-		collection = c.workspaces[0][1][sel-1]
-		print "Selected Collection: ",collection.title
-		
-		# Create a submission: build the zip files
-		temp = True # delete the zip file at the end of the upload	
-		if zipfile.is_zipfile(data):
-			zipf = data
-			temp = False
-		elif os.path.isfile(data): # This is a single file
-			dataname = os.path.basename(data)
-			zipf = os.path.splitext(dataname)[0]+".zip"
-			myzip = zipfile.ZipFile(zipf, "w")
-			myzip.write(data)
-			myzip.close()
-		elif os.path.isdir(data): # This is a directory, zip all the files and maintain the structure!
-			dataname = os.path.basename(os.path.normpath(data))
-			zipf = dataname+".zip"
-			myzip = zipfile.ZipFile(zipf, "w")
-			# get the directory structure
-			for root, dirs, files in os.walk(data):
-				for name in files:
-					myzip.write(os.path.join(root,name))
-			myzip.close()
-		else:
-			print "Couldn't find the data."
-			sys.exit()
-		
-		#Check if this is a METSDSpaceSIP: see if there is a mets.xml file in the zip
-		myzip = zipfile.ZipFile(zipf)
-		if "mets.xml" in myzip.namelist():
-			packaging = "http://purl.org/net/sword/package/METSDSpaceSIP"
-			type = "METS"
-		else:
-			packaging = "http://purl.org/net/sword/package/SimpleZip"
-			type = "SimpleZip"
-		
-		print "------------------------"
-		print "This is a ",type," submission"
-		myzip.close()
-
-		payload = open(zipf, "rb")
-		try:
-			receipt_dep = c.create(col_iri = collection.href,
-			payload = payload,
-			filename = zipf,
-			mimetype = "application/zip",
-			packaging = packaging)
-			print type, " submission successful."
-			if type == "SimpleZip":
-				# If some of the additional arguments for author, title, date etc. have been specified, update the metadata
-				if (args.title != None) or (args.author != None) or (args.date != None):
-					entry = Entry()	
-					print "------------------------"
-					print "Updating with additional metadata"
-					if  args.title != None:
-						entry.add_fields(dcterms_title = args.title[0])
-					if args.author != None:
-						for creator in args.author:
-							entry.add_fields(dcterms_creator=creator)
-					if args.date != None:
-						entry.add_fields(dcterms_created = args.date[0])
-					try:
-						receipt_update = c.update(dr = receipt_dep , metadata_entry = entry, in_progress = True) # in_progress is True: we don't want to close the submission
-						print "Additional metadata updated successfully."
-					except:
-						print "Server error"
-			print "------------------------"
-			print "You will find this submission in the \"Submissions\" list in your DSpace account. To complete/edit it with metadata and licenses, click on the title and then on \"Resume\"."			
-		except:
-			print "Error! Couldn't submit the file!"
-			if type == "METS": # Just guessing: not sure this is the problem...
-				print "To submit a METS package, the collection MUST have a workflow!"
-		payload.close()
-		
-	else: # Failed to connect to SWORDv2 Server
-		print "Couldn't connect to the server."
-		if attempts == 0:
-			print "Invalid credentials entered 3 times."
-	if temp:
-		os.remove(zipf)
-	
-except KeyboardInterrupt:
-	print "------------------------"
-	print "\nSubmission aborted by user."
-	
Binary file sword2-libraries-pyinstaller-compatible/tests/example.zip has changed
--- a/sword2-libraries-pyinstaller-compatible/tests/example/mets.xml	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<mets ID="sort-mets_mets" OBJID="sword-mets" LABEL="DSpace SWORD Item"
-	PROFILE="DSpace METS SIP Profile 1.0" xmlns="http://www.loc.gov/METS/"
-	xmlns:xlink="http://www.w3.org/1999/xlink"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://www.loc.gov/METS/ http://www.loc.gov/standards/mets/mets.xsd">
-
-	<metsHdr CREATEDATE="2007-09-01T00:00:00">
-		<agent ROLE="CUSTODIAN" TYPE="ORGANIZATION">
-			<name>Richard Jones</name>
-		</agent>
-	</metsHdr>
-	
-	<dmdSec ID="sword-mets-dmd-1" GROUPID="sword-mets-dmd-1_group-1">
-		<mdWrap LABEL="SWAP Metadata" MDTYPE="OTHER" OTHERMDTYPE="EPDCX"
-			MIMETYPE="text/xml">
-
-			<xmlData>
-				<epdcx:descriptionSet
-					xmlns:epdcx="http://purl.org/eprint/epdcx/2006-11-16/"
-					xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-					xsi:schemaLocation="http://purl.org/eprint/epdcx/2006-11-16/ http://purl.org/eprint/epdcx/xsd/2006-11-16/epdcx.xsd">
-
-					<epdcx:description
-						epdcx:resourceId="sword-mets-epdcx-1">
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/type"
-							epdcx:valueURI="http://purl.org/eprint/entityType/ScholarlyWork" />
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/title">
-							<epdcx:valueString>
-								Attempts to detect retrotransposition
-								and de novo deletion of Alus and other
-								dispersed repeats at specific loci in
-								the human genome
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/terms/abstract">
-							<epdcx:valueString>
-								Dispersed repeat elements contribute to
-								genome instability by de novo insertion
-								and unequal recombination between
-								repeats. To study the dynamics of these
-								processes, we have developed single DNA
-								molecule approaches to detect de novo
-								insertions at a single locus and
-								Alu-mediated deletions at two different
-								loci in human genomic DNA. Validation
-								experiments showed these approaches
-								could detect insertions and deletions at
-								frequencies below 10(-6) per cell.
-								However, bulk analysis of germline
-								(sperm) and somatic DNA showed no
-								evidence for genuine mutant molecules,
-								placing an upper limit of insertion and
-								deletion rates of 2 x 10(-7) and 3 x
-								10(-7), respectively, in the individuals
-								tested. Such re-arrangements at these
-								loci therefore occur at a rate lower
-								than that detectable by the most
-								sensitive methods currently available.
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/creator">
-							<epdcx:valueString>
-								Hollies, C.R.
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/creator">
-							<epdcx:valueString>
-								Monckton, D.G.
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/creator">
-							<epdcx:valueString>
-								Jeffreys, A.J.
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/identifier">
-							<epdcx:valueString
-								epdcx:sesURI="http://purl.org/dc/terms/URI">
-								http://www.myu.ac.uk/some/identifier
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/eprint/terms/isExpressedAs"
-							epdcx:valueRef="sword-mets-expr-1" />
-					</epdcx:description>
-
-					<epdcx:description
-						epdcx:resourceId="sword-mets-expr-1">
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/type"
-							epdcx:valueURI="http://purl.org/eprint/entityType/Expression" />
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/language"
-							epdcx:vesURI="http://purl.org/dc/terms/RFC3066">
-							<epdcx:valueString>en</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/elements/1.1/type"
-							epdcx:vesURI="http://purl.org/eprint/terms/Type"
-							epdcx:valueURI="http://purl.org/eprint/type/JournalArticle" />
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/dc/terms/available">
-							<epdcx:valueString
-								epdcx:sesURI="http://purl.org/dc/terms/W3CDTF">
-								2001-02
-							</epdcx:valueString>
-						</epdcx:statement>
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/eprint/terms/status"
-							epdcx:vesURI="http://purl.org/eprint/terms/Status"
-							epdcx:valueURI="http://purl.org/eprint/status/PeerReviewed" />
-						<epdcx:statement
-							epdcx:propertyURI="http://purl.org/eprint/terms/copyrightHolder">
-							<epdcx:valueString>
-								Nature Publishing Group
-							</epdcx:valueString>
-						</epdcx:statement>
-					</epdcx:description>
-				</epdcx:descriptionSet>
-			</xmlData>
-		</mdWrap>
-	</dmdSec>
-
-	<fileSec>
-		<fileGrp ID="sword-mets-fgrp-1" USE="CONTENT">
-			<file GROUPID="sword-mets-fgid-0" ID="sword-mets-file-1"
-				MIMETYPE="application/pdf">
-				<FLocat LOCTYPE="URL" xlink:href="pdf1.pdf" />
-			</file>
-			<file GROUPID="sword-mets-fgid-1" ID="sword-mets-file-2"
-				MIMETYPE="application/pdf">
-				<FLocat LOCTYPE="URL" xlink:href="pdf2.pdf" />
-			</file>
-			<file GROUPID="sword-mets-fgid-2" ID="sword-mets-file-3"
-				MIMETYPE="application/pdf">
-				<FLocat LOCTYPE="URL" xlink:href="pdf3.pdf" />
-			</file>
-		</fileGrp>
-	</fileSec>
-	
-	<structMap ID="sword-mets-struct-1" LABEL="structure"
-		TYPE="LOGICAL">
-		<div ID="sword-mets-div-1" DMDID="sword-mets-dmd-1" TYPE="SWORD Object">
-			<div ID="sword-mets-div-2" TYPE="File">
-				<fptr FILEID="sword-mets-file-1" />
-			</div>
-			<div ID="sword-mets-div-3" TYPE="File">
-				<fptr FILEID="sword-mets-file-2" />
-			</div>
-			<div ID="sword-mets-div-4" TYPE="File">
-				<fptr FILEID="sword-mets-file-3" />
-			</div>
-		</div>
-	</structMap>
-
-</mets>
Binary file sword2-libraries-pyinstaller-compatible/tests/example/pdf1.pdf has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/example/pdf2.pdf has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/example/pdf3.pdf has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/foo.zip has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/footest/.DS_Store has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/footest/PDF1.pdf has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/footest/subfoo/PDF2.pdf has changed
Binary file sword2-libraries-pyinstaller-compatible/tests/pdfs.zip has changed
--- a/sword2-libraries-pyinstaller-compatible/tests/testzip.py	Tue May 29 12:44:46 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-import zipfile,os
-
-data = './footest/'
-
-if zipfile.is_zipfile(data):
-	zipf = data
-elif os.path.isfile(data): # This is a single file
-	dataname = os.path.basename(data)
-	zipf = os.path.splitext(dataname)[0]+".zip"
-	myzip = zipfile.ZipFile(zipf, "w")
-	myzip.write(data)
-	myzip.close()
-elif os.path.isdir(data): # This is a directory, zip all the files and maintain the structure!
-	dataname = os.path.basename(os.path.normpath(data))
-	zipf = dataname+".zip"
-	myzip = zipfile.ZipFile(zipf, "w")
-	# get the os.walk
-	for root, dirs, files in os.walk(data):
-		for name in files:
-			myzip.write(os.path.join(root,name))
-	myzip.close()
\ No newline at end of file