Logo Search packages:      
Sourcecode: virt-manager version File versions  Download package

def virtManager::IPy::IPint::strNormal (   self,
  wantprefixlen = None 
)

Return a string representation in the usual format.

>>> print IP('127.0.0.1').strNormal()
127.0.0.1
>>> print IP('2001:0658:022a:cafe:0200::1').strNormal()
2001:658:22a:cafe:200:0:0:1

Definition at line 449 of file IPy.py.

00449                                              :
        """Return a string representation in the usual format.

        >>> print IP('127.0.0.1').strNormal()
        127.0.0.1
        >>> print IP('2001:0658:022a:cafe:0200::1').strNormal()
        2001:658:22a:cafe:200:0:0:1
        """

        if self.WantPrefixLen == None and wantprefixlen == None:
            wantprefixlen = 1
        
        if self._ipversion == 4:
            ret = self.strFullsize(0) 
        elif self._ipversion == 6:
            ret = ':'.join([hex(x)[2:] for x in [int(x, 16) for x in self.strFullsize(0).split(':')]])
        else:
            raise ValueError, "only IPv4 and IPv6 supported"

            
        
        return ret + self._printPrefix(wantprefixlen)

    def strFullsize(self, wantprefixlen = None):


Generated by  Doxygen 1.6.0   Back to index