Beispiel #1
0
    def test_urlfriendly(self, app, client):
        from app.helpers import urlfriendly

        friendly = urlfriendly("Ul #öß1!!\"§$%&-<LiNk>")

        self.assertFalse("U" in friendly)
        self.assertFalse("#" in friendly)
        self.assertFalse(" " in friendly)
        self.assertFalse("ö" in friendly)
        self.assertFalse("ß" in friendly)
        self.assertFalse("!" in friendly)
        self.assertFalse("\"" in friendly)
        self.assertFalse("§" in friendly)
        self.assertFalse("$" in friendly)
        self.assertFalse("%" in friendly)
        self.assertFalse("&" in friendly)
        self.assertFalse("<" in friendly)
        self.assertFalse(">" in friendly)

        self.assertEqual(friendly.lower(), friendly)

        friendly = urlfriendly("thistextistdefinitelylongerthan20characters")
        self.assertEqual(friendly, "thistextistdefinitel")

        friendly = urlfriendly("this-text-is-definitely-longer-than-20-characters")
        self.assertEqual(friendly, "this-text-is-definitely")
Beispiel #2
0
    def format_date(self, epoch, year, month, day, timestamp, use_abbr,
                    with_link=False, use_epoch=True, use_year=True, with_weekday=False):
        from app.helpers import urlfriendly
        day_str = str(day)

        if with_weekday:
            day_str = f"{self.day_of_the_week(timestamp, use_abbr)}, {day_str}"

        month_str = month.abbreviation if use_abbr and month.abbreviation else month.name

        if with_link:
            url = url_for('event.list_epoch_year', e_id=epoch.id, year=year, e_name=urlfriendly(epoch.name))
            year_str = f'<a href="{url}">{year}</a>'
        else:
            year_str = str(year)

        epoch_str = epoch.abbreviation if use_abbr and epoch.abbreviation else epoch.name

        if with_link:
            url = url_for('event.list_epoch', e_id=epoch.id, e_name=urlfriendly(epoch.name))
            epoch_str = f'<a href="{url}">{epoch_str}</a>'

        if use_epoch and use_year:
            return f'{day_str}. {month_str} {year_str}, {epoch_str}'
        elif use_year and not use_epoch:
            return f'{day_str}. {month_str} {year_str}'

        return f'{day_str}. {month_str}'
Beispiel #3
0
 def view_url(self):
     return url_for('campaign.view',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #4
0
 def settings_url(self):
     return url_for("map.map_settings",
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #5
0
 def delete_url(self):
     return url_for('calendar.month_delete',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #6
0
 def edit_url(self):
     return url_for('session.edit',
                    id=self.id,
                    name=urlfriendly(self.title))
Beispiel #7
0
 def anchor_text(self):
     return urlfriendly(f"session-{self.session_number}")
Beispiel #8
0
 def edit_url(self):
     return url_for('party.edit', id=self.id, name=urlfriendly(self.name))
Beispiel #9
0
 def delete_url(self):
     return url_for('character.delete',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #10
0
 def edit_url(self):
     return url_for('character.edit',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #11
0
 def view_url(self):
     return url_for('character.view',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #12
0
 def delete_url(self):
     return url_for('character.journal_delete',
                    c_id=self.character.id,
                    c_name=urlfriendly(self.character.name),
                    j_id=self.id,
                    j_name=urlfriendly(self.title))
Beispiel #13
0
 def anchor_text(self):
     return urlfriendly(f"journal-{self.id}")
Beispiel #14
0
 def view_url(self):
     return url_for('media.list_by_cat',
                    c_id=self.id,
                    c_name=urlfriendly(self.name))
Beispiel #15
0
 def edit_url(self):
     return url_for('campaign.edit',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #16
0
 def view_url(self):
     return url_for('party.view', id=self.id, name=urlfriendly(self.name))
Beispiel #17
0
 def view_url(self):
     return url_for('event.list_category', c_id=self.id, c_name=urlfriendly(self.name))
Beispiel #18
0
 def delete_url(self):
     return url_for('party.delete', id=self.id, name=urlfriendly(self.name))
Beispiel #19
0
 def edit_url(self):
     return url_for('event.category_edit', id=self.id, name=urlfriendly(self.name))
Beispiel #20
0
 def view_url(self):
     return url_for('session.view',
                    id=self.id,
                    name=urlfriendly(self.title))
Beispiel #21
0
 def edit_url(self):
     return url_for('calendar.month_edit',
                    id=self.id,
                    name=urlfriendly(self.name))
Beispiel #22
0
 def delete_url(self):
     return url_for('session.delete',
                    id=self.id,
                    name=urlfriendly(self.title))
Beispiel #23
0
def index():
    return redirect(url_for("wiki.view", id=1, name=urlfriendly("Main Page")))