summaryrefslogtreecommitdiffstats
path: root/src/Types.py
blob: af4c4e56be04834f0c91499b45a1fab54d2bbd96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python

from binascii import b2a_base64

class ConfigFile(object):
    format="<ConfigFile name='%s' owner='%s' group='%s' perms='%s' encoding='%s'>%s</ConfigFile>"
    def __init__(self,name,owner,group,perms,content,encoding='ascii'):
        self.name=name
        self.owner=owner
        self.group=group
        self.perms=perms
        self.content=content
        self.encoding=encoding
        if encoding == 'base64':
            self.xcontent=b2a_base64(content)
        else:
            self.xcontent=self.content
        
    def XMLSerialize(self):
        return self.format%(self.name,self.owner,self.group,self.perms,self.encoding,self.xcontent)