Esempio n. 1
0
    def get_list(self):
        for tr in self.document.getroot().xpath('//tr[contains(@id, "ctl00_ContentPlaceHolder1_ctl00_ctl09_COMPTE_INFOS_0_GrilleInfos_ctl00__0")]'):
            username=tr[1].text+"_"+tr[0].text

        for i, tr in enumerate(self.document.getroot().xpath('//tr[contains(@id, "ctl00_ContentPlaceHolder1_ctl00_ctl10_COMPTE_RESA_1_1_GrilleResas_ctl00__")]')):
            book = Book('%s%d' % (username, i))
            # if all the books booked are available, there are only 7 columns.
            # if (at least ?) one book is still not available, yous can cancel, and the first column does contain the checkbox. So 8 columns.
            if (len(tr) == 7):
                start = 2
            if (len(tr) == 8):
                start = 3
            book.name = tr[start].text
            book.author = tr[start+1].text
            book.date = txt2date(tr[start+3].text)
            book.late = False
            yield book
Esempio n. 2
0
    def get_list(self):
        for tr in self.document.getroot().xpath('//tr[contains(@id, "ctl00_ContentPlaceHolder1_ctl00_ctl09_COMPTE_INFOS_0_GrilleInfos_ctl00__0")]'):
            username=tr[1].text+"_"+tr[0].text

        for i, tr in enumerate(self.document.getroot().xpath('//tr[contains(@id, "ctl00_ContentPlaceHolder1_ctl00_ctl10_COMPTE_RESA_1_1_GrilleResas_ctl00__")]')):
            book = Book('%s%d' % (username, i))
            # if all the books booked are available, there are only 7 columns.
            # if (at least ?) one book is still not available, yous can cancel, and the first column does contain the checkbox. So 8 columns.
            if (len(tr) == 7):
                start = 2
            if (len(tr) == 8):
                start = 3
            book.name = tr[start].text
            book.author = tr[start+1].text
            book.date = txt2date(tr[start+3].text)
            book.late = False
            yield book