Пример #1
0
def get_url(text, *args):
    # *args needed to receive prefix and suffix for markdowns wikilinks ext
    from waliki.settings import get_slug
    slug = get_slug(text)
    if slug:
        return reverse('waliki_detail', args=(get_slug(text), ))
    return ''
Пример #2
0
def get_url(text, *args):
    # *args needed to receive prefix and suffix for markdowns wikilinks ext
    from waliki.settings import get_slug
    slug = get_slug(text)
    if slug:
        return reverse('waliki_detail', args=(get_slug(text),))
    return ''
Пример #3
0
def create_acl_for_user_wiki_own_page(sender, **kwargs):
    user = kwargs['user']
    perms = Permission.objects.filter(
        content_type__app_label='waliki',
        codename__in=('add_page', 'change_page')).values_list('id', flat=True)

    rule, created = ACLRule.objects.get_or_create(
        name='pagina propia {}'.format(str(user)),
        slug='miembros/{}'.format(get_slug(user.username)),
        apply_to=ACLRule.TO_EXPLICIT_LIST,
        as_namespace=True)
    if created:
        rule.permissions.add(*perms)
        rule.users.add(user)
Пример #4
0
def create_acl_for_user_wiki_own_page(sender, **kwargs):
    user = kwargs['user']
    perms = Permission.objects.filter(content_type__app_label='waliki',
                                      codename__in=('add_page', 'change_page')).values_list(
        'id', flat=True)

    rule, created = ACLRule.objects.get_or_create(name='pagina propia {}'.format(str(user)),
                              slug='miembros/{}'.format(
                                  get_slug(user.username)),
                              apply_to=ACLRule.TO_EXPLICIT_LIST,
                              as_namespace=True
                              )
    if created:
        rule.permissions.add(*perms)
        rule.users.add(user)
Пример #5
0
    def from_path(cls, path, markup=None):
        filename, ext = os.path.splitext(path)
        if markup and isinstance(markup, string_types):
            markup = _markups.find_markup_class_by_name(markup)
        else:
            markup = _markups.find_markup_class_by_extension(ext)
        page = Page(path=path, slug=get_slug(filename), markup=markup.name)
        page.title = page._get_part('get_document_title')

        while True:
            try:
                page.save()
                break
            except IntegrityError:
                page.slug += '-'
        return page
Пример #6
0
    def from_path(cls, path, markup=None):
        filename, ext = os.path.splitext(path)
        if markup and isinstance(markup, string_types):
            markup = _markups.find_markup_class_by_name(markup)
        else:
            markup = _markups.find_markup_class_by_extension(ext)
        page = Page(path=path, slug=get_slug(filename), markup=markup.name)
        page.title = page._get_part('get_document_title')

        while True:
            try:
                page.save()
                break
            except IntegrityError:
                page.slug += '-'

        return page
Пример #7
0
def wikify(value, prefix=''):
    slug = get_slug(prefix + str(value))
    return reverse('waliki_detail', args=[slug])
Пример #8
0
def wikify(value, prefix=''):
    slug = get_slug(prefix + str(value))
    return reverse('waliki_detail', args=[slug])