コード例 #1
0
 def section(self, section=None):
     the_section = Section.get(section)
     titles_in_section = [
         t for t in the_section.titles if t.copies_in_status("STOCK") > 0
     ]
     titles_in_section.sort(key=lambda x: x.booktitle)
     #titles_in_section=Title.select("kind_id=1 and title.id=section_title.title_id and titletag.tagvalue='History' and titletag.tagkey='section'",clauseTables=["section_title"],orderBy="booktitle",distinct=True)
     return dict(authorswidget=AuthorsWidget(),
                 titlelistwidget=TitleListWidget(),
                 the_section=the_section,
                 in_this_section=titles_in_section)
コード例 #2
0
 def edit_title(self,title_id,**kw):
     title=Title.get(title_id)
     if kw['preferred_distributor']:
         title.set_unique_tag(category='distribution',key='preferred',value=kw['preferred_distributor'])
     if kw.has_key('sections'):
         the_sections=kw['sections']
         if type(the_sections) != type([0,1]):
             the_sections=[the_sections]
         #title.set_tag_collection(category='inventory',key='section',values=the_sections)
         for s in title.sections:
             print "Removing %s" % s 
             title.removeSection(s)
         for s in the_sections:
             print "Adding %s" % s 
             title.addSection(Section.get(s))
         
     return self.title(title_id)
コード例 #3
0
    def edit_title(self, title_id, **kw):
        title = Title.get(title_id)
        if kw['preferred_distributor']:
            title.set_unique_tag(category='distribution',
                                 key='preferred',
                                 value=kw['preferred_distributor'])
        if kw.has_key('sections'):
            the_sections = kw['sections']
            if type(the_sections) != type([0, 1]):
                the_sections = [the_sections]
            #title.set_tag_collection(category='inventory',key='section',values=the_sections)
            for s in title.sections:
                print "Removing %s" % s
                title.removeSection(s)
            for s in the_sections:
                print "Adding %s" % s
                title.addSection(Section.get(s))

        return self.title(title_id)
コード例 #4
0
 def section(self,section=None):
     the_section=Section.get(section)
     titles_in_section=[t for t in the_section.titles if t.copies_in_status("STOCK")>0]   
     titles_in_section.sort(key=lambda x: x.booktitle)
     #titles_in_section=Title.select("kind_id=1 and title.id=section_title.title_id and titletag.tagvalue='History' and titletag.tagkey='section'",clauseTables=["section_title"],orderBy="booktitle",distinct=True)
     return dict(authorswidget=AuthorsWidget(),titlelistwidget=TitleListWidget(),the_section=the_section,in_this_section=titles_in_section)
コード例 #5
0
 def section(self,section_id,**kw):
     section=Section.get(section_id)
     return dict(section=section)
コード例 #6
0
 def section(self, section_id, **kw):
     section = Section.get(section_id)
     return dict(section=section)