Changeset 10683


Ignore:
Timestamp:
2 Nov 2013, 08:18:00 (11 years ago)
Author:
Henrik Bettermann
Message:

hostel_id must not be readonly. Otherwise updateEntry doesn't work in update mode.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/hostels
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py

    r9701 r10683  
    187187    grok.name('addhostel')
    188188    #grok.template('hosteladdpage')
    189     form_fields = grok.AutoFields(IHostel).omit('beds_reserved')
     189    form_fields = grok.AutoFields(IHostel).omit('beds_reserved', 'hostel_id')
    190190    label = _('Add hostel')
    191191    pnav = 5
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py

    r10680 r10683  
    8787    hostel_id = schema.TextLine(
    8888        title = _(u'Hostel Id'),
    89         readonly = True,
    9089        )
    9190
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py

    r10680 r10683  
    516516        shutil.rmtree(self.workdir)
    517517        return
     518
     519    def test_import_update(self):
     520        self.processor = HostelProcessor()
     521        self.workdir = tempfile.mkdtemp()
     522        self.csv_file = os.path.join(self.workdir, 'sample_hostel_data.csv')
     523        open(self.csv_file, 'wb').write(HOSTEL_SAMPLE_DATA)
     524        self.csv_file = os.path.join(self.workdir, 'sample_hostel_data.csv')
     525        open(self.csv_file, 'wb').write(HOSTEL_SAMPLE_DATA)
     526        num, num_warns, fin_file, fail_file = self.processor.doImport(
     527            self.csv_file, HOSTEL_HEADER_FIELDS)
     528        # We import the same file in update mode
     529        num, num_warns, fin_file, fail_file = self.processor.doImport(
     530            self.csv_file, HOSTEL_HEADER_FIELDS, 'update')
     531        self.assertEqual(num_warns,0)
     532        logcontent = open(self.logfile).read()
     533        self.assertTrue(
     534            "Hostel Processor - sample_hostel_data - block-a-upper-hostel - "
     535            "updated: "
     536            "beds_for_pre=['G'], floors_per_block=1, "
     537            "beds_for_final=['A', 'B'], rooms_per_floor=32, "
     538            "blocks_for_male=[], hostel_id=block-a-upper-hostel, "
     539            "sort_id=20, beds_for_returning=['C', 'D'], "
     540            "hostel_name=Block A Upper Hostel, beds_for_fresh=['E', 'F'], "
     541            "blocks_for_female=['A'], beds_for_all=[], beds_reserved=[]"
     542            in logcontent)
     543        shutil.rmtree(os.path.dirname(fin_file))
     544        shutil.rmtree(self.workdir)
     545        return
Note: See TracChangeset for help on using the changeset viewer.