Changeset 34989

Show
Ignore:
Timestamp:
04/07/06 18:21:17 (4 years ago)
Author:
gracinet
Message:

#1542: no <table> elt in profile just keeps the existing table

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • CPSSchemas/trunk/CHANGES

    r34762 r34989  
    77Bug fixes: 
    88~~~~~~~~~~ 
    9 
     9- #1542: lack of <table> element in XML file describing a layout 
     10  doesn't erase the table anymore 
    1011New internal features: 
    1112~~~~~~~~~~~~~~~~~~~~~~ 
  • CPSSchemas/trunk/exportimport/layout.py

    r34744 r34989  
    267267                rows.append(row) 
    268268            break 
    269         else: # no <table> node, hence no purge=False on it (compat with 3.4.0) 
    270             rows = [] 
     269        else: # no <table> node, do nothing 
     270            return 
    271271        self.context.setLayoutDefinition({'rows': rows}) 
    272272 
  • CPSSchemas/trunk/tests/test_exportimport.py

    r34753 r34989  
    195195        self.assertEquals(cell, {'widget_id': 'NewCell', 'ncols': 2}) 
    196196 
    197     def test_initTable_purge_by_default(self): 
    198         # check that the purge=False implementation dosen't change anything 
    199         # if not present 
     197    def test_initTable_no_purge_by_noelement(self): 
    200198        self.setPurge(False) 
    201199        self.object.setLayoutDefinition({ 
     
    207205        self.importString('<?xml version="1.0"?>' 
    208206                          ' <object name="the_layout">' 
     207                          ' </object>') 
     208        rows = self.object.getLayoutDefinition()['rows'] 
     209        self.assertEquals(len(rows), 2) 
     210        row = rows[1] 
     211        self.assertEquals(len(row), 1) 
     212        cell = row[0] 
     213        self.assertEquals(cell, {'widget_id': 'Description', 'ncols': 2}) 
     214 
     215    def test_initTable_purge_by_default(self): 
     216        # check that the purge=False implementation dosen't change anything 
     217        # if not present 
     218        self.setPurge(False) 
     219        self.object.setLayoutDefinition({ 
     220            'style_prefix': 'layout_metadata_', 
     221            'ncols': 2, 
     222            'rows': [ 
     223            [{'ncols': 2, 'widget_id': 'Title'},], 
     224            [{'ncols': 2, 'widget_id': 'Description'},],]}) 
     225        self.importString('<?xml version="1.0"?>' 
     226                          ' <object name="the_layout">' 
    209227                          '  <table>' 
    210228                          '   <row><cell name="NewCell"/></row>'