MCPcopy Index your code
hub / github.com/aboutcode-org/vulnerablecode / setTimestamp

Method setTimestamp

vulnerabilities/lib_oval.py:648–666  ·  view source on GitHub ↗

Sets a value for the timestamp element. If that elememtn does not exist, one will be created. If the timestamp argument is set to None, the timestamp will be set to the current time.

(self, timestamp)

Source from the content-addressed store, hash-verified

646 return None
647
648 def setTimestamp(self, timestamp):
649 """
650 Sets a value for the timestamp element. If that elememtn does not exist, one will be created.
651 If the timestamp argument is set to None, the timestamp will be set to the current time.
652 """
653 if self.element is None:
654 return False
655
656 if not timestamp or timestamp is None:
657 now = datetime.date.today()
658 timestamp = now.strftime(OvalDocument.TIME_FORMAT)
659
660 child = self.element.find("oval:timestamp", OvalDocument.NS_OVAL)
661 if child is not None:
662 child.text = timestamp
663 else:
664 child = Element("{" + OvalDocument.NS_OVAL.get("oval") + "}timestamp")
665 child.text = timestamp
666 self.element.append(child)
667
668 def getExtra(self, name, namespace=None):
669 """

Callers 2

__init__Method · 0.95
getGeneratorMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected