Exemplo n.º 1
0
    def __init__(self, chapterData, parent=None):
        """
		path is a tab-delimited curriculum data file`
		"""
        BackPackModelObject.__init__(self, parent)
        self.shortTitle = chapterData.chapter
        self.num = chapterData.num
        self.longTitle = chapterData.chapter
        self.topics = chapterData.data
        self.unit = chapterData.unit
Exemplo n.º 2
0
    def __init__(self, unitData, parent=None):
        """
		path is a tab-delimited curriculum data file
		"""
        BackPackModelObject.__init__(self, parent)
        self.name = unitData.name
        self.chapters = unitData.data
        self.shortTitle = self.name
        self.longTitle = self.name
        self.description = unitData.blurb
Exemplo n.º 3
0
    def __init__(self, topicData, parent=None):
        """
		path is a tab-delimited curriculum data file`
		"""
        BackPackModelObject.__init__(self, parent)
        self.topicName = topicData.topicName
        self.topicSentence = topicData.topicSentence
        self.topPicks = topicData.topPicks

        print "worksheet %s has %d records" % (self.topicName,
                                               len(self.topPicks))
Exemplo n.º 4
0
    def __init__(self, topPickData=None, parent=None):
        """
		path is a tab-delimited curriculum data file`
		"""
        self.title = self.url = self.summary = self.keywords = ""
        BackPackModelObject.__init__(self, parent)
        if topPickData:
            self.title = topPickData.title
            self.url = topPickData.url
            self.summary = topPickData.summary
            self.keywords = topPickData.keywords
        self.record = self.getRecord()
        self.num = topPickData.num

        if not self.url:
            raise Exception, 'url not supplied for %s' % self.title
Exemplo n.º 5
0
    def getRecord(self):
        """
		get template record, and then populate with topPick data
		NOTEs:
			- ID has to be set before the record can be written
		"""
        if not self.record:
            rec = BackPackModelObject.getRecord(self)
            rec.xpath_delimiter = ':'
            rec.setTitle(self.title)

            rec.setPrimaryUrl(self.url)
            rec.setDescription(self.summary)
            for kw in self.keywords:
                rec.add_keyword(kw)
        return self.record
Exemplo n.º 6
0
    def getRecord(self):
        """
		get template record, and then populate with topic data
		NOTEs:
			- 'object' is set in template
			- ID has to be set before the record can be written
		"""
        if not self.record:
            rec = BackPackModelObject.getRecord(self)
            rec.setShortTitle(self.topicName)
            rec.setLongTitle(self.topicName)
            rec.set('contents', self.topicSentence)

            for topPickData in self.topPicks:
                topPickRelation = rec.makeRelation(topPickData)
                rec.addRelation(topPickRelation)
            self.record = rec
            self.write()
        return self.record
Exemplo n.º 7
0
    def getRecord(self):
        """
		get template record, and then populate with chapter data
		NOTEs:
			- 'object' is set in template
			- ID has to be set before the record can be written
		"""
        if not self.record:
            rec = BackPackModelObject.getRecord(self)
            rec.setShortTitle(self.shortTitle)
            rec.setLongTitle(self.longTitle)

            for topic in self.getChildren().values():  # TabData instances
                topicRelation = rec.makeRelation(topic)
                rec.addRelation(topicRelation)

            self.record = rec
            self.write()

        return self.record