Beispiel #1
0
  def create_new(self, spec):

    current_tree = SloeTrees.inst().get_tree(spec["tree"])
    source = current_tree.get_item_from_spec(spec)

    if source:
      # Preserve UUID of item
      self.data["uuid"] = source["uuid"]
    else:
      # No pre-existing item, so take all info from passed-in spec
      source = spec
      self.data["uuid"] = uuid.uuid4()

    for element in ("leafname", "name", "primacy", "tree", "subtree", "worth"):
      if source[element] != spec[element]:
        logging.error("Mismatched original item: element %s new %s !=  old %s" % (
          element, spec[element], source[element]))
        print "%s %s" % (pformat(spec), pformat(source))
      self.data[element] = source[element]
Beispiel #2
0
 def get_file_dir(self):
   root_dir = SloeTrees.inst().get_tree_root_dir(self.data["tree"])
   return os.path.join(root_dir, self.data["primacy"], self.data["worth"], self.data["tree"], self.data["subtree"])