Commits

Anonymous committed be97b8b

Several documentation and tool improvements from patch by Filipe Correia

  • Participants
  • Parent commits 3ed3569

Comments (0)

Files changed (5)

   smaller simpler codebase, pluggability through entry_points instead of ZCA.
 - New docs and examples, simpler direct integration with external databases
 - Update mods format and support for EU GAL metadata MODS extension
+- Several documentation and tool improvements by Filipe Correia
 
 MOAI 1.1.2 (2010-09-30)
 -----------------------
 
 Configuration is done in the settings.ini file. The default settings file uses the Paste#urlmap application to map wsgi applications to a url.
 
-In the `composite:main` section is a line:
+In the `composite:main` section there is a line:
 
 /oai = moai_example
 
 Adding Content
 ==============
 
-The Moai system is designed to fetch periodically fetch content from a `provider`, and convert that to Moais internal format, which can then be translated in the different metadata formats from the oaipmh feed.
+The Moai system is designed to periodically fetch content from a `provider`, and convert it to Moai's internal format, which can then be translated to the different metadata formats for the oaipmh feed.
 
 Moai comes with an example that shows this principle:
 
-In the moai/moai directory are two XML files. Let's pretend these files are from a remote system, and we want to publish them with MOAI.
+In the moai/moai directory there are two XML files. Let's pretend these files are from a remote system, and we want to publish them with MOAI.
 
 In the settings.ini file, the following option is specified:
 
 
 http://localhost:8080/oai?verb=ListRecords&metadataPrefix=oai_dc
 
-This should return a nowRecordsMatch error.
+This should return a noRecordsMatch error.
 
 To add the content, run the update_content script, with the section name from the settings.ini as argument
 
-> ./bin/update_content moai_example
+> ./bin/update_moai moai_example
 
 This will produce the following output:
 
                    dict,
                    prefix="record %s" % oai_id,
                    suffix='for parameter "metadata"')
-        
-        metadata = json.dumps(metadata)
+
+        def date_handler(obj):
+            if hasattr(obj, 'isoformat'):
+                return obj.isoformat()
+            else:
+                raise TypeError, 'Object of type %s with value of %s is not JSON serializable' % (type(obj), repr(obj))
+
+        metadata = json.dumps(metadata, default=date_handler)
         self._cache['records'][oai_id] = (dict(modified=modified,
                                                deleted=deleted,
                                                metadata=metadata))
         self.id = None
         self.modified = None
         self.deleted = None
-        self.data = None
         self.sets = None
-        
+        self.metadata = None
+
     def update(self, path):
         doc = etree.parse(path)
         xpath = XPath(doc, nsmap={'x':'http://example.org/data'})
     if not os.path.isfile(config_path):
         sys.stderr.write('No config_path file found at %s,\n'
                          'Start script from other directory '
-                         'or use --config_path option\n''' % config_path)
+                         'or use --config option\n''' % config_path)
         sys.exit(1)
     configfile = ConfigParser.ConfigParser()
     configfile.read(config_path)
             *time.strptime(options.from_date, fmt)[:6])
     else:
         from_date = None
-        
+
     database = SQLDatabase(config['database'])
+
+    ContentClass = None
     for content_point in iter_entry_points(group='moai.content',
                                            name=config['content']):
         ContentClass = content_point.load()
 
+    if ContentClass is None:
+        sys.stderr.write('Unknown content class: %s\n' % (config['content'],))
+        sys.exit(1)
+
     provider_name = config['provider'].split(':', 1)[0]
+    provider = None
     for provider_point in iter_entry_points(group='moai.provider',
                                            name=provider_name):
         provider = provider_point.load()(config['provider'])
 
+    if provider is None:
+        sys.stderr.write('Unknown provider: %s\n' % (provider_name,))
+        sys.exit(1)
 
     log = get_moai_log()
-    
+    provider.set_logger(log)
+
     progress = ProgressBar()
-    error_count = 0
     starttime = time.time()
 
     sys.stderr.write('Updating content provider..')