profile
viewpoint
Adrian ThiefMaster CERN / @indico Geneva, Switzerland

indico/newdle 38

Open Source Collaborative enterprise meeting scheduling tool.

ThiefMaster/coreaudio-dotnet 9

Ray Molenkamp's .NET library for the Windows CoreAudio framework

indico/ursh 5

A REST µservice for URL shortening — based on Flask, made @ CERN ⚛️

pferreir/indico 1

The Indico Project (mirror)

ThiefMaster/flask 1

A microframework based on Werkzeug, Jinja2 and good intentions

indico/indico-plugins-attic 0

Unmaintained Indico plugins

Leats/indico 0

Indico - A feature-rich event management system, made @ CERN, the place where the Web was born.

Leats/newdle 0

Open Source Collaborative enterprise meeting scheduling tool.

mic4ael/indico 0

The Indico Project

issue commentpallets/jinja

Template "filename" using Template constructor / from_string

Thanks @davidism - your suggestion looks like exactly what I was after. I will update my code to use a loader.

stevelittlefish

comment created time in 42 minutes

issue commentpallets/jinja

"Class has no attribute property_name" caused by any error in property.

Thanks for the bug report. Feel free to submit a PR! Would definitely be more helpful than sending us a workaround called "Jinja is dumb" 😛

i definitely planned to look into making a PR. sorry the name was just my way to let out the frustration of being held up by this for a few hours, doesn't look that great to others, i admit. to clarify i work with jinja of my own volition and dont think its a bad tool at all.

laundmo

comment created time in 3 hours

issue closedpallets/jinja

Template "filename" using Template constructor / from_string

When you create a template by passing a string into the Template constructor, if there is an exception raised by that template it appears in the stack trace like this:

File "<template>", line 2, in top-level template code

I would like to be able to pass a string into the Template constructor to identify the template in the stack trace like this:

my_template = Template('<html>{{ invalid_variable }}</html>', identifier='<Product: ball-bearings>')

Which would cause the exception to be rendered like this:

File "<Product: ball-bearings>", line 2, in top-level template code

This would make it a lot easier to find template issues when you have a lot of small templates rendered in a loop.

closed time in 3 hours

stevelittlefish

issue commentpallets/jinja

Template "filename" using Template constructor / from_string

While it would be possible to add an argument to from_string, I think that might give users the impression that it's appropriate to use from_string as you've described, for lots of small templates. If a project is rendering so many small templates with errors that it becomes hard to tell them apart, that's an indication they should write a loader. It will give full control and greatly speed up rendering.

stevelittlefish

comment created time in 3 hours

issue closedpallets/jinja

"Class has no attribute property_name" caused by any error in property.

Whenever a property thats used in a jinja2 template throws any error, jinja2 will replace that error with "Class has no attribute property_name", which is a plain wrong error message.

How to reproduce:

from jinja2 import Environment
from jinja2.runtime import StrictUndefined

class MyClass():
    @property
    def faulty_property(self):
        return self.doesntexist

env = Environment(undefined=StrictUndefined) 
t = env.from_string("{{ obj.faulty_property }}")
print(t.render(obj=MyClass()))

Actual error: '__main__.MyClass object' has no attribute 'faulty_property' Expected error: 'MyClass' object has no attribute 'doesntexist'

I have implemented a workaround for this myself, the code for which can be found here: https://gist.github.com/laundmo/acb9e26345c1454dd6029391e895f844

Environment:

  • Python version: 3.9.0
  • Jinja version: Jinja2-2.11.2

closed time in 3 hours

laundmo

issue commentpallets/jinja

"Class has no attribute property_name" caused by any error in property.

Duplicate of #854, see also #313.

laundmo

comment created time in 3 hours

issue commentpallets/jinja

Template "filename" using Template constructor / from_string

env = Environment()
code = env.compile("source", filename="<product>")
t = env.template_class.from_code(env, code, env.globals)

You can also do this by making your own loader, Loader.load returns a tuple of code, filename, up_to_date_callback. If you're creatinga bunch of templates the way you're describing, that's a good idea regardless of wanting custom filenames, as it will be able to take advantage of the compilation cache.

stevelittlefish

comment created time in 3 hours

issue commentpallets/jinja

"Class has no attribute property_name" caused by any error in property.

Thanks for the bug report. Feel free to submit a PR! Would definitely be more helpful than sending us a workaround called "Jinja is dumb" 😛

laundmo

comment created time in 3 hours

issue openedpallets/jinja

"Class has no attribute property_name" caused by any error in property.

Whenever a property thats used in a jinja2 template throws any error, jinja2 will replace that error with "Class has no attribute property_name", which is a plain wrong error message.

How to reproduce:

from jinja2 import Environment
from jinja2.runtime import StrictUndefined

class MyClass():
    @property
    def faulty_property(self):
        return self.doesntexist

env = Environment(undefined=StrictUndefined) 
t = env.from_string("{{ obj.faulty_property }}")
obj = MyClass()
print(t.render(obj=obj))

Actual error: '__main__.MyClass object' has no attribute 'faulty_property' Expected error: 'MyClass' object has no attribute 'doesntexist'

I have implemented a workaround for this myself, the code for which can be found here: https://gist.github.com/laundmo/acb9e26345c1454dd6029391e895f844

Environment:

  • Python version: 3.9.0
  • Jinja version: Jinja2-2.11.2

created time in 4 hours

issue openedpallets/jinja

Template "filename" using Template constructor / from_string

When you create a template by passing a string into the Template constructor, if there is an exception raised by that template it appears in the stack trace like this:

File "<template>", line 2, in top-level template code

I would like to be able to pass a string into the Template constructor to identify the template in the stack trace like this:

my_template = Template('<html>{{ invalid_variable }}</html>', identifier='<Product: ball-bearings>')

Which would cause the exception to be rendered like this:

File "<Product: ball-bearings>", line 2, in top-level template code

This would make it a lot easier to find template issues when you have a lot of small templates rendered in a loop.

created time in 7 hours

issue commentindico/indico

Allow customization of the subject of the reminder send by email

thanks for the pointer to customize the instance. too bad we cannot do that easily on cern indico.

vlimant

comment created time in 8 hours

issue closedindico/indico

Unexpected label behaviour when approving blockings

In room booking, after creating a blocking, the label for the accept button is misplaced and flickers. This sometimes makes it difficult to actually click and approve the blocking.

rb

closed time in 9 hours

plourenco

issue commentindico/indico

Unexpected label behaviour when approving blockings

Closed has this no longer happens in 3.0. https://github.com/Semantic-Org/Semantic-UI-React/releases/tag/v2.0.1

plourenco

comment created time in 9 hours

Pull request review commentindico/indico-user-docs

Add documentation for Zoom plugin

+# Zoom Integration++!!! warning+    This feature is only available in servers where the+    [Zoom Plugin](https://github.com/indico/indico-plugins/tree/master/vc_zoom) is installed.++Indico allows meeting organisers to create a Zoom meeting and manage it directly from the management area of their+event. Once created, the connection information of the Zoom meeting is displayed to the participants of the meeting,+and additional buttons are added to the interface letting participants to easily connect to the Zoom meeting, and+organisers to connect their physical meeting room to the Zoom meeting.++## Managing Zoom Meetings++On the management page of your Indico event click on _Videoconference_ under the tab _Services_ on the left banner.++![](../assets/zoom/videoconf_menu.png)++Here you can _create_ a new Zoom meeting or _Add_ an existing one to your event.++![](../assets/zoom/videoconf_list.png)++Simply click on one option then select the Zoom videoconference service.

Probably not, if there's only one, they'll see the other dialog straight away. We can perhaps remove this in the CERN version of things once Vidyo goes away.

pferreir

comment created time in 9 hours

created repositorymitsuhiko/wasm-example-please-ignore

Bla

created time in 10 hours

Pull request review commentindico/indico

contributions in mails: Add missing external flag

     <ul>         {% for contribution in contributions %}             <li>-                <a href="{{ url_for('contributions.display_contribution', contribution) }}">{{ contribution.title }}</a>+                <a href="{{ url_for('contributions.display_contribution', contribution, _external=True) }}">{{ contribution.title }}</a>

Done

bpedersen2

comment created time in 12 hours

PR opened indico/indico

contributions in mails: Add missing external flag

The external flag was missing on url_for, so the links where relative.

+1 -1

0 comment

1 changed file

pr created time in 12 hours

PR opened indico/indico-user-docs

Add CERN-specific documentation for Zoom plugin

I decided to keep the file under plugins/zoom.md, so that whenever there are updates in master and we merge back we can get the fixes for free (or a conflict, which shouldn't be hard to solve). The position in the menu is also different from the vanilla version.

+77 -6

0 comment

8 changed files

pr created time in 12 hours

issue openedindico/indico

Allow customization of the subject of the reminder send by email

Is your feature request related to a problem? Please describe. I am sending the reminder to basecamp that expects the subject to start with "Discussion:" hence I'd like to be able to customize the subject of the reminder email.

Describe the solution you'd like Under the popup to edit the reminder, being able to customize the subject would be great with available %title %date %time tokens for example, defaulting to "[Indico][Event Reminder]%title (%date, %time)"

Describe alternatives you've considered there's no alternative that I can think of.

created time in 14 hours

issue closedpallets/jinja

Issue with basic Template Inheritance

I am trying to do the most basic template inheritance here, and it simply won't work. The image below shows my setup, and I'm using Python 3.9. Can anyone figure out what is wrong?

image

Python File:

from jinja2 import Environment, FileSystemLoader

env = Environment(loader=FileSystemLoader('Templates') )
template = env.get_template('ipn.txt')

with open('output.cfg', 'w') as file:
    file.write(template.render())

Filename: ipn.txt

{% block foo -%}
!!!
{% endblock foo -%}

Filename: foo.txt

{% extends "ipn.txt" %}

{% block foo %}
foo
{% endblock foo %}

Output.cfg should contain foo when rendering completes, but it just stubbornly contains !!!.

closed time in a day

Wyko

issue commentpallets/jinja

Issue with basic Template Inheritance

You need to render the the foo template if you want what the foo template would render.

Please use Stack Overflow for questions about your own code. This tracker is for issues related to the project itself. Be sure to include a minimal, complete, and verifiable example.

Wyko

comment created time in a day

issue openedpallets/jinja

Issue with basic Template Inheritance

I am trying to do the most basic template inheritance here, and it simply won't work. The image below shows my setup, and I'm using Python 3.9. Can anyone figure out what is wrong?

image

Python File:

from jinja2 import Environment, FileSystemLoader

env = Environment(loader=FileSystemLoader('Templates') )
template = env.get_template('ipn.txt')

with open('output.cfg', 'w') as file:
    file.write(template.render())

Filename: ipn.txt

{% block foo -%}
!!!
{% endblock foo -%}

Filename: foo.txt

{% extends "ipn.txt" %}

{% block foo %}
foo
{% endblock foo %}

Output.cfg should contain foo when rendering completes, but it just stubbornly contains !!!.

created time in a day

issue closedpallets/click

Shell completion documentation does not match code behavior

Using latest stable version of click 7.2.1 and documentations from https://click.palletsprojects.com/en/7.x/bashcomplete/#activation-script

Opposed to what documentation says, the only command that seams to produce the shell script seams to be _FOO_COMPLETE=source foo

But documentation indicates to run _FOO_COMPLETE=source_zsh foo (or bash), which do not produce anything, even worse returning success code all the time.

I know that there is some work done to rewrite the completion for 8.x release but that future release is already known to break lots of users, making impossible to adopt even if it would released today.

Expected Behavior

Be able to rely on documentation.

Actual Behavior

Zero output when running commands from documentations.

Environment

  • Python version: 3.8 (any)
  • Click version: 7.1.2

closed time in a day

ssbarnea

issue commentpallets/click

Shell completion documentation does not match code behavior

I can't reproduce this issue. All four source commands for the 7.x release (source / source_bash, source_zsh, source_fish) behave as expected.

ssbarnea

comment created time in a day

Pull request review commentindico/indico

Clone custom abstract fields

 Bugfixes   for Editing (:pr:`4715`) - Fix filename pattern check in Editing when a filename contains dots (:pr:`4715`) - Require explicit admin override (or being whitelisted) to override blockings (:pr:`4706`)+- Clone custom abstract fields (:pr:`4724`, thanks :user:`bpedersen2`)

Done

bpedersen2

comment created time in a day

Pull request review commentindico/indico

Clone custom abstract fields

 class AbstractSettingsCloner(EventCloner):     name = 'abstracts_settings'     friendly_name = _('Call for Abstracts (settings, email templates, review questions)')-    requires = {'contribution_types', 'tracks'}+    requires = {'contribution_types', 'tracks', 'contribution_fields'}

Done

bpedersen2

comment created time in a day

Pull request review commentindico/indico

Clone custom abstract fields

 def _get_feature_definitions(sender, **kwargs): @signals.event_management.get_cloners.connect def _get_cloners(sender, **kwargs):     yield AbstractSettingsCloner+    yield ContributionFieldCloner

Done

bpedersen2

comment created time in a day

Pull request review commentindico/indico-plugins

LiveSync/Citadel: Support Citadel as the sync backend

+# This file is part of the Indico plugins.+# Copyright (C) 2002 - 2020 CERN+#+# The Indico plugins are free software; you can redistribute+# them and/or modify them under the terms of the MIT License;+# see the LICENSE file for more details.++from __future__ import unicode_literals++import itertools++from marshmallow import post_dump+from tika import parser+from webargs import fields++from indico.core.db.sqlalchemy.links import LinkType+from indico.core.db.sqlalchemy.principals import PrincipalType+from indico.core.db.sqlalchemy.protection import ProtectionMode+from indico.core.marshmallow import mm+from indico.modules.attachments.models.attachments import Attachment, AttachmentType+from indico.modules.events import Event+from indico.modules.events.contributions.models.contributions import Contribution+from indico.modules.events.contributions.models.subcontributions import SubContribution+from indico.modules.events.notes.models.notes import EventNote+from indico.web.flask.util import url_for+++def _get_location(obj):+    if obj.venue_name and obj.room_name:+        return '{}: {}'.format(obj.venue_name, obj.room_name)+    elif obj.venue_name or obj.room_name:+        return obj.venue_name or obj.room_name+    else:+        return ''+++def _get_identifiers(principal):+    if principal.principal_type == PrincipalType.user:+        # Instead of using the email this uses `User:ID`.+        # Since the user can change the email this is better as+        # it will ensure that only this given Indico user has access.+        # If you want to stick with email, simply replace it with+        # 'User:{}'.format(principal.email)+        yield principal.identifier+        yield principal.email+    elif principal.principal_type == PrincipalType.event_role:+        for user in principal.members:+            yield user.identifier+            yield principal.email+    elif principal.is_group:+        yield principal.identifier+++def _get_category_path(obj):+    if isinstance(obj, Event):+        event = obj+    elif isinstance(obj, Attachment):+        event = obj.folder.event+    else:+        event = obj.event+    return event.category.chain_titles+++def _get_event_acl(event):+    if event.effective_protection_mode == ProtectionMode.public:+        acl = ['']

@ThiefMaster what do you think?

mic4ael

comment created time in a day

PR opened pallets/click

Added FloatRange to API docs

Adds FloatRange documentation to API docs by adding it to api.rst.

Fixes #1718

+2 -0

0 comment

1 changed file

pr created time in a day

more