Example #1
0
    def __call__(self):
        barcamps = self.app.config.dbs.db.barcamps
        # we  loop over raw data because the format cannot be serialized yet
        for b in barcamps.find():
            self.barcamp = b

            log.info("converting %s" %b['name'])

            # fix the single event to contain all necessary new fields
            e = b['events'][0]
            e = self.fix_event(e)
            self.fix_design()

            # generate the events
            self.generate_events(e)

            # fix location (move it from event to barcamp)
            self.fix_location(e)

            # convert all markdown to html
            b['description'] = markdownify(b['description'])
            log.info("converted description")
            pages = self.app.config.dbs.pages.for_slot("menu", barcamp=self.barcamp)
            for page in pages:
                page.content = markdownify(page.content)
                page.save()
                log.info("converted page %s" %page.title)


            barcamps.save(b)
            log.info("barcamp %s saved" %self.barcamp['name'])
Example #2
0
    def __call__(self):
        barcamps = self.app.config.dbs.db.barcamps
        # we  loop over raw data because the format cannot be serialized yet
        for b in barcamps.find():
            self.barcamp = b

            log.info("converting %s" % b['name'])

            # fix the single event to contain all necessary new fields
            e = b['events'][0]
            e = self.fix_event(e)
            self.fix_design()

            # generate the events
            self.generate_events(e)

            # fix location (move it from event to barcamp)
            self.fix_location(e)

            # convert all markdown to html
            b['description'] = markdownify(b['description'])
            log.info("converted description")
            pages = self.app.config.dbs.pages.for_slot("menu",
                                                       barcamp=self.barcamp)
            for page in pages:
                page.content = markdownify(page.content)
                page.save()
                log.info("converted page %s" % page.title)

            barcamps.save(b)
            log.info("barcamp %s saved" % self.barcamp['name'])
Example #3
0
    def fix_event(self, e):
        """add all the missing fields to the initial event"""
        size = self.barcamp['size']
        e = copy.copy(e) # better work with a copy

        if not e.has_key("_id"):
            e['_id'] = unicode(uuid.uuid4())
            log.info("id added,")
        if not e.has_key("size"):
            e['size'] = size
            log.info("size added,")
        if not e.has_key("timetable"):
            e['timetable'] = {}
            log.info("timetable added")
        if not e.has_key("maybe"):
            e['maybe'] = []
            log.info("maybe added",)
        if not e.has_key("own_location"):
            e['own_location'] = False
            log.info("own location set")
        e['description'] = markdownify(e['description'])
        return e
Example #4
0
    def fix_event(self, e):
        """add all the missing fields to the initial event"""
        size = self.barcamp['size']
        e = copy.copy(e)  # better work with a copy

        if not e.has_key("_id"):
            e['_id'] = unicode(uuid.uuid4())
            log.info("id added,")
        if not e.has_key("size"):
            e['size'] = size
            log.info("size added,")
        if not e.has_key("timetable"):
            e['timetable'] = {}
            log.info("timetable added")
        if not e.has_key("maybe"):
            e['maybe'] = []
            log.info("maybe added", )
        if not e.has_key("own_location"):
            e['own_location'] = False
            log.info("own location set")
        e['description'] = markdownify(e['description'])
        return e