From bc77f532986acb28da8b6d6668b24915288e57c8 Mon Sep 17 00:00:00 2001 From: Philippe Ombredanne Date: Mon, 12 Jun 2017 18:54:44 +0200 Subject: [PATCH] Do not stringify empty attributes #12 * instead check first if the value exist and only stringify if this is the case (this avoids returning 'None' as string). Signed-off-by: Philippe Ombredanne --- pymaven/pom.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pymaven/pom.py b/pymaven/pom.py index edd5fb2..c822425 100644 --- a/pymaven/pom.py +++ b/pymaven/pom.py @@ -355,24 +355,24 @@ def properties(self): if isinstance(self.parent, Artifact): properties['parent.groupId'] = self.parent.group_id properties['parent.artifactId'] = self.parent.artifact_id - properties['parent.version'] = str(self.parent.version) + properties['parent.version'] = self.parent.version and str(self.parent.version) properties['project.parent.groupId'] = self.parent.group_id properties['project.parent.artifactId'] = self.parent.artifact_id - properties['project.parent.version'] = str(self.parent.version) + properties['project.parent.version'] = self.parent.version and str(self.parent.version) properties['pom.parent.groupId'] = self.parent.group_id properties['pom.parent.artifactId'] = self.parent.artifact_id - properties['pom.parent.version'] = str(self.parent.version) + properties['pom.parent.version'] = self.parent.version and str(self.parent.version) # built-in properties properties['artifactId'] = self.artifact_id properties['groupId'] = self.group_id - properties['version'] = str(self.version) + properties['version'] = self.version and str(self.version) properties['project.artifactId'] = self.artifact_id properties['project.groupId'] = self.group_id - properties['project.version'] = str(self.version) + properties['project.version'] = self.version and str(self.version) properties['pom.artifactId'] = self.artifact_id properties['pom.groupId'] = self.group_id - properties['pom.version'] = str(self.version) + properties['pom.version'] = self.version and str(self.version) properties.update(self._find_properties()) properties.update(self._find_prerequisites())