2 # Copyright (C) 2005 Mathieu Ignacio -- mignacio@april.org
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 def __init__(self,data="") :
26 for each in range(len(self._str)) :
27 self._list.append(ord(self._str[each]))
28 elif str_type == list :
30 self._str = "".join(map(chr,self._list))
31 else : raise TypeError , 'strlist init : Valid types are str and list of int'
37 # return list (useful for DhcpPacket class)
48 """ Useful function for native python operations """
51 return self._str.__hash__()
56 def __nonzero__(self) :
57 if self._str != "" : return 1
60 def __cmp__(self,other) :
61 if self._str == other : return 0