Switch to unified view

a/OSSEval/entity/models.py b/OSSEval/entity/models.py
...
...
5
    name = models.CharField(max_length=200)
5
    name = models.CharField(max_length=200)
6
    actual_entity_class = models.CharField(max_length=200) #the class that implements the actual entity instance
6
    actual_entity_class = models.CharField(max_length=200) #the class that implements the actual entity instance
7
    actual_entity_app = models.CharField(max_length=200) #the app where the above classes are
7
    actual_entity_app = models.CharField(max_length=200) #the app where the above classes are
8
    def from_xml(self, xmldoc, insert = True):
8
    def from_xml(self, xmldoc, insert = True):
9
        if not insert:
9
        if not insert:
10
            self.id = xmldoc.getElementsByTagName('Id')[0].firstChild.data
10
            self.id = xmlMinidom.getNaturalAttribute(xmldoc, 'Id')
11
        self.name = xmlMinidom.getString(xmldoc, 'Name')
11
        self.name = xmlMinidom.getStringAttribute(xmldoc, 'Name')
12
        self.actual_entity_class = xmlMinidom.getString(xmldoc, 'ActualEntityClass')
12
        self.actual_entity_class = xmlMinidom.getStringAttribute(xmldoc, 'ActualEntityClass')
13
        self.actual_entity_app = xmlMinidom.getString(xmldoc, 'ActualEntityApp')
13
        self.actual_entity_app = xmlMinidom.getStringAttribute(xmldoc, 'ActualEntityApp')
14
        # I save so I get the ID (if insert == True)
14
        # I save so I get the ID (if insert == True)
15
        self.save()
15
        self.save()
16
    def to_xml(self):
16
    def to_xml(self):
17
        str_xml = "<Id>" + str(self.id) + "</Id>"
17
        return '<Entity Id="' + str(self.id) + '" Name="' + self.name + '" ActualEntityClass="' + self.actual_entity_class + '" ActualEntityApp="' + self.actual_entity_app + '"/>'
18
        str_xml += "<Name>" + self.name + "</Name>"
19
        str_xml += "<ActualEntityClass>" + self.actual_entity_class + "</ActualEntityClass>"
20
        str_xml += "<ActualEntityApp>" + self.actual_entity_app + "</ActualEntityApp>"
21
        return "<Entity>" + str_xml + "</Entity>"
22
    
18
    
23
    def __unicode__(self):
19
    def __unicode__(self):
24
        return self.name
20
        return self.name
25
21
26
    
22