How to use the template.template function in template

To help you get started, we’ve selected a few template examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackatbrown / 2015.hackatbrown.org / hack-at-brown-2015 / registration.py View on Github external
def accept_hacker(hacker):
	#print "actually accepting hacker"
	hacker.deadline = (datetime.datetime.now() + datetime.timedelta(seconds=admission_expiration_seconds()))
	if hacker.deadline > datetime.datetime(2015, 2, 7):
		hacker.deadline = datetime.datetime(2015, 2, 7)
	email = template("emails/admitted.html", {"hacker": hacker, "deadline": hacker.deadline.strftime("%m/%d/%y"), "name":hacker.name.split(" ")[0]})
	send_email(recipients=[hacker.email], html=email, subject="You got off the Waitlist for Hack@Brown!")

	hacker.admitted_email_sent_date = datetime.datetime.now()
	hacker.put()
	memcache.add("admitted:{0}".format(hacker.secret), "1", memcache_expiry)
github sagemath / sagenb / sagenb / notebook / worksheet.py View on Github external
def html_save_discard_buttons(self):
        r"""
        OUTPUT:
        
        - string -- the HTML for the save, discard, etc. buttons

        EXAMPLES::

            sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Test', 'admin')
            sage: W.html_save_discard_buttons()
            '\n\n<button title="Save changes" name="button_save">Save&lt;...'
        """
        return template(os.path.join("worksheet","save_discard_buttons.html"),
                        doc_worksheet = self.is_doc_worksheet())
        </button>
github sagemath / sagenb / sagenb / notebook / worksheet.py View on Github external
def html_menu(self):
        r"""
        OUTPUT:
        
        - string -- the HTML for the menus of the worksheet

        EXAMPLES::
        
            sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Test', 'admin')
            sage: W.html_menu()
            '\n&nbsp;&nbsp;&nbsp;<select class="worksheet">\n    ...'
        """
        return template(os.path.join("worksheet","menu.html"),
                        name = _notebook.clean_name(self.name()),
                        filename_ = self.filename(), data = sorted(self.attached_data_files()),
                        systems_enumerated = enumerate(self.notebook().systems()),
                        system_names = self.notebook().system_names(),
                        current_system_index = self.system_index(),
                        pretty_print = self.pretty_print(),
                        doc_worksheet = self.is_doc_worksheet())
</select>
github sipb / homeworld / building / build-debs / homeworld-admin-tools / src / configuration.py View on Github external
def get_keyclient_yaml(variant: str) -> str:
    if variant not in KEYCLIENT_VARIANTS:
        command.fail("invalid variant %s; expected one of %s" % (variant, KEYCLIENT_VARIANTS))
    config = Config.load_from_project()
    kcli = {"KEYSERVER": config.keyserver.hostname + "." + config.external_domain,
            "MASTER": variant == "master",
            "WORKER": variant in ("worker", "master"),
            "BASE": variant == "base"}
    return template.template("keyclient.yaml", kcli)
github sagemath / sagenb / sagenb / notebook / worksheet.py View on Github external
EXAMPLES::
        
            sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Test', 'admin')
            sage: W.html()
            '\n\n\n<div id="cell_resizer" class="cell_input_active"></div>\n\n
github CodeTriangle / Perplexicon / template.py View on Github external
self.before_pos = before_pos
        self.before_list = before_list
        self.use_numbers = use_numbers
        self.before_def = before_def
        self.after_def = after_def
        self.after_list = after_list
        self.after = after
        
template_list = dict([
    ("default", template()),
    ("multiline", template(before_defs=":", before_pos="\n  ", before_list="", use_numbers = False, before_def="\n    - ", after_list = "\n")),
    ("html", template(before_term="<b>", before_defs="</b> -- ", before_pos="<i>(", before_list=")</i> ", use_numbers=True, after="<br>\n")),
    ("multiline-html", template(before_term="<p><b>", before_defs="</b><br></p><ul>", before_pos="<li>", before_list="<ul>", use_numbers=False, before_def="<li>", after_def="</li>", after_list="</ul>", after="</li></ul><p></p>\n")),
    ("latex", template(before_term="\\textbf{", before_defs="} -- ", before_pos="\\textit{(", before_list=")} ", use_numbers=True)),
    ("webster", template(before_defs=" ", before_pos="", before_list=": ", use_numbers=True, before_def=". ", after_def=" ", after_list="  ")),
    ("webster-html", template(before_term="<b>", before_defs="</b> ", before_pos="<i>", before_list="</i> ", use_numbers=True, before_def=". ", after_def=" ", after_list="", after="<br>\n"))
])
github hackatbrown / 2015.hackatbrown.org / hack-at-brown-2015 / main.py View on Github external
def get(self):
			variables = {
				"registration_status": config.registration_status()
			}
			if config.registration_status() == config.REGISTRATION_OPEN:
				variables['registration_post_url'] = blobstore.create_upload_url('/register')
			self.response.write(template("index.html", variables))
github sagemath / sagelib / sage / server / notebook / notebook.py View on Github external
sage: nb = sage.server.notebook.notebook.Notebook(tmp_dir())
            sage: W = nb.create_new_worksheet('Test', 'admin')
            sage: nb.html_beforepublish_window(W, 'admin')
            '\n\n<br><br><br>\n\n\n    \n'
        """
        msg = """You can publish your worksheet to the Internet, where anyone will be able to access and view it online.
        Your worksheet will be assigned a unique address (URL) that you can send to your friends and colleagues.<br><br>
        Do you want to publish this worksheet?<br><br>
        <form action="." method="get">
        <input value="" name="yes" type="hidden">
        <input style="margin-left:10px" value="Yes" type="submit">
        <input style="margin-left:5px" value="No" type="button"><br><br>
        <input style="margin-left:13px" name="auto" type="checkbox"> Automatically re-publish when changes are made
        </form>
        """
        return template("notebook/beforepublish_window.html", worksheet = worksheet,
                        worksheet_filename = worksheet.filename(),
                        username = username, JSMATH = JSMATH,
                        JSMATH_IMAGE_FONTS = JSMATH_IMAGE_FONTS,
                        JEDITABLE_TINYMCE = JEDITABLE_TINYMCE,
                        sage_jsmath_macros = sage_jsmath_macros)
github hackatbrown / 2015.hackatbrown.org / hack-at-brown-2015 / db_utils.py View on Github external
def get(self):
        jinjaVars = {"properties" : hacker_keys}
        return self.response.write(template("db_cleanup.html", jinjaVars))
github sipb / homeworld / building / build-debs / homeworld-admin-tools / src / configuration.py View on Github external
def get_local_kubeconfig() -> str:
    key_path, cert_path, ca_path = access.get_kube_cert_paths()
    kconf = {"APISERVER": get_apiserver_default(),
             "AUTHORITY-PATH": ca_path,
             "CERT-PATH": cert_path,
             "KEY-PATH": key_path}
    return template.template("kubeconfig-local.yaml", kconf)