Changeset - 16a6c7c3c071
[Not reviewed]
0 2 0
Lance Edgar - 10 years ago 2015-02-27 18:49:50
ledgar@sacfoodcoop.com
Add `GPC.pretty()` method.
2 files changed with 9 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rattail/db/model/products.py
Show inline comments
 
@@ -219,7 +219,7 @@ associates, if any.
 
        """
 
        if self.upc is None:
 
            return None
 
        return "{0}-{1}".format(unicode(self.upc)[:-1], unicode(self.upc)[-1])
 
        return self.upc.pretty()
 

	
 
    def cost_for_vendor(self, vendor):
 
        """
rattail/gpc.py
Show inline comments
 
@@ -99,3 +99,11 @@ class GPC(object):
 

	
 
    def __unicode__(self):
 
        return u'%014d' % self.value
 

	
 
    def pretty(self):
 
        """
 
        Returns the UPC as a somewhat more human-readable string.  Basically
 
        that just means the check digit is distinguished by a hyphen.
 
        """
 
        upc = unicode(self)
 
        return "{0}-{1}".format(upc[:-1], upc[-1])
0 comments (0 inline, 0 general)