コード例 #1
0
ファイル: ro_command.py プロジェクト: agarrido/ro-manager
def status(progname, configbase, options, args):
    """
    Display status of a designated research object

    ro status [ -d dir ]
    """
    # Check command arguments
    ro_config = ro_utils.readconfig(configbase)
    ro_options = {
        "rodir":   options.rodir or "",
        }
    log.debug("ro_options: "+repr(ro_options))
    # Find RO root directory
    ro_dir = ro_root_directory(progname+" status", ro_config, ro_options['rodir'])
    if not ro_dir: return 1
    # Read manifest and display status
    if options.verbose: 
        print "ro status -d \"%(rodir)s\""%ro_options
    ro_dict = ro_manifest.readManifest(ro_dir)
    print "Research Object status"
    print "  identifier:  %(roident)s, title: %(rotitle)s"%ro_dict
    print "  creator:     %(rocreator)s, created: %(rocreated)s"%ro_dict
    print "  path:        %(ropath)s"%ro_dict
    if ro_dict['rouri']:
        print "  uri:         %(rouri)s"%ro_dict
    print "  description: %(rodescription)s"%ro_dict
    return 0
コード例 #2
0
ファイル: TestROSupport.py プロジェクト: agarrido/ro-manager
 def checkManifestContent(self, rodir, roname, roident):
     manifest = ro_manifest.readManifest(rodir)
     self.assertEqual(manifest['roident'],       roident, "RO identifier")
     self.assertEqual(manifest['rotitle'],       roname,  "RO title")
     self.assertEqual(manifest['rocreator'],     ro_test_config.ROBOXUSERNAME, "RO creator")
     # See: http://stackoverflow.com/questions/969285/
     #      how-do-i-translate-a-iso-8601-datetime-string-into-a-python-datetime-object
     rocreated = datetime.datetime.strptime(manifest['rocreated'], "%Y-%m-%dT%H:%M:%S")
     timenow   = datetime.datetime.now().replace(microsecond=0)
     rodelta   = timenow-rocreated
     self.assertTrue(rodelta.seconds<=1, 
         "Unexpected created datetime: %s, expected about %s"%
             (manifest['rocreated'],timenow.isoformat()))
     self.assertEqual(manifest['rodescription'], roname,  "RO name")
     return