This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from odoo import models, fields, api | |
from json_field import JsonField | |
class Person(models.Model): | |
_name = 'example.person' | |
_description = 'Person with json details' | |
details = JsonField() # a json object represented as dict / list / python primitives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[source]] | |
name = "pypi" | |
url = "https://pypi.org/simple" | |
verify_ssl = true | |
[dev-packages] | |
pylint = "*" | |
[packages] | |
sqlalchemy = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original source from http://asyncio.readthedocs.io/en/latest/producer_consumer.html | |
# Rewritten for Python >=3.4 | |
import asyncio | |
import random | |
@asyncio.coroutine | |
def produce(queue, n): | |
for x in range(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from concurrent.futures import Executor | |
from functools import partial | |
from multiprocessing.pool import ThreadPool as ThreadPoolBase | |
log = logging.getLogger() | |
class ThreadPool(ThreadPoolBase, Executor): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Handle History Mode and custom 404/500" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions logicalGrouping="MatchAll"> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from datetime import datetime, timezone | |
import os | |
def utc_now(): | |
# utcnow returns a naive datetime, so we have to set the timezone manually <sigh> | |
return datetime.utcnow().replace(tzinfo=timezone.utc) | |
class Terminator: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<el-menu :router="true" :default-active="activeLink"> | |
<template v-for="rule in $router.options.routes"> | |
<el-submenu v-if="rule.children && rule.children.length > 0" | |
:index="rule.path" | |
> | |
<template slot="title"><i :class="rule.icon"></i>{{ rule.title }}</template> | |
<el-menu-item v-for="child in rule.children" :index="rule.path + '/' + child.path">{{ child.title }}</el-menu-item> | |
</el-submenu> | |
<el-menu-item v-else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.http import Http404 | |
from django.core.urlresolvers import RegexURLResolver | |
from django.conf.urls import url | |
from wagtail.wagtailcore.models import Page | |
class SuperPage(Page): | |
""" | |
This class extends Page by adding methods to allow urlconfs to be embedded inside pages |