Exemple #1
0
    def __init__(self,
                 content,
                 edit_by,
                 edit_date,
                 may_revise=False,
                 page=None,
                 diff=None,
                 renderer='wiki'):
        self.page_content_md = content
        if renderer == 'wiki':
            self.page_content = wikimarkdown(content)
        elif renderer == 'verbify':
            self.page_content = safemarkdown(content)
        elif renderer == 'stylesheet':
            self.page_content = SubverbifyStylesheetSource(content).render()
        elif renderer == "automoderator":
            self.page_content = AutoModeratorConfig(content).render()
        elif renderer == "rawcode":
            self.page_content = RawCode(content).render()

        self.renderer = renderer
        self.page = page
        self.diff = diff
        self.edit_by = edit_by
        self.may_revise = may_revise
        self.edit_date = edit_date
        self.base_url = c.wiki_base_url
        Templated.__init__(self)
Exemple #2
0
 def __init__(self):
     # convert language codes to real names
     language_summary = traffic.PageviewsByLanguage.top_last_month()
     locale = c.locale
     self.language_summary = []
     for language_code, data in language_summary:
         name = LanguageTraffic.get_language_name(language_code, locale)
         self.language_summary.append(((language_code, name), data))
     Templated.__init__(self)
Exemple #3
0
    def __init__(self, place):
        self.place = place

        self.traffic_last_modified = traffic.get_traffic_last_modified()
        self.traffic_lag = (datetime.datetime.utcnow() -
                            self.traffic_last_modified)

        self.make_tables()

        Templated.__init__(self)
Exemple #4
0
    def __init__(self, system, subject):
        from v1.models.admin_notes import AdminNotesBySystem

        self.system = system
        self.subject = subject
        self.author = c.user.name
        self.notes = AdminNotesBySystem.in_display_order(system, subject)
        # Convert timestamps for easier reading/translation
        for note in self.notes:
            note["timesince"] = timesince(note["when"])
        Templated.__init__(self)
Exemple #5
0
 def __init__(self,
              settings,
              mayedit,
              show_editors=True,
              show_settings=True,
              page=None,
              **context):
     self.permlevel = settings['permlevel']
     self.listed = settings['listed']
     self.show_settings = show_settings
     self.show_editors = show_editors
     self.page = page
     self.base_url = c.wiki_base_url
     self.mayedit = mayedit
     Templated.__init__(self)
Exemple #6
0
    def __init__(self, thing, campaign, before, after):
        self.thing = thing
        self.campaign = campaign
        self.before = before
        self.after = after
        self.period = datetime.timedelta(days=7)
        self.prev = None
        self.next = None
        self.has_live_campaign = False
        self.has_early_campaign = False
        self.detail_name = ('campaign %s' % campaign._id36 if campaign
                                                           else 'all campaigns')

        editable = c.user_is_sponsor or c.user._id == thing.author_id
        self.traffic_last_modified = traffic.get_traffic_last_modified()
        self.traffic_lag = (datetime.datetime.utcnow() -
                            self.traffic_last_modified)
        self.make_hourly_table(campaign or thing)
        self.make_campaign_table()
        Templated.__init__(self)
Exemple #7
0
    def __init__(self):
        self.srs, self.invalid_srs, self.report = [], [], []

        self.textarea = request.params.get("subverbifys")
        if self.textarea:
            requested_srs = [srname.strip()
                             for srname in self.textarea.splitlines()]
            subverbifys = Subverbify._by_name(requested_srs)

            for srname in requested_srs:
                if srname in subverbifys:
                    self.srs.append(srname)
                else:
                    self.invalid_srs.append(srname)

            if subverbifys:
                self.report = make_subverbify_traffic_report(subverbifys.values())

            param = urllib.quote(self.textarea)
            self.csv_url = "/traffic/subverbifys/report.csv?subverbifys=" + param

        Templated.__init__(self)
Exemple #8
0
 def __init__(self, link, *a, **kw):
     Templated.__init__(self, *a, **kw)
     self.link = link
Exemple #9
0
 def __init__(self, user):
     Templated.__init__(self)
     self.user = user
Exemple #10
0
 def __init__(self, page_content='', previous='', page=None):
     self.page_content = page_content
     self.page = page
     self.previous = previous
     self.base_url = c.wiki_base_url
     Templated.__init__(self)
Exemple #11
0
 def __init__(self, pages, linear_pages, page=None):
     self.pages = pages
     self.page = page
     self.linear_pages = linear_pages
     self.base_url = c.wiki_base_url
     Templated.__init__(self)
Exemple #12
0
 def __init__(self, page):
     self.page = page
     self.base_url = c.wiki_base_url
     Templated.__init__(self)
Exemple #13
0
 def __init__(self, listing, page=None):
     self.listing = listing
     self.page = page
     Templated.__init__(self)
Exemple #14
0
 def __init__(self, revisions, page=None):
     self.listing = revisions
     self.page = page
     Templated.__init__(self)