This file contains hidden or 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
# There should only be a few permissions across your whole application. | |
permissions = { | |
'view': 'view', | |
} | |
class RegContextFactory(): | |
@property | |
def __acl__(self): |
This file contains hidden or 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 time import sleep | |
from Arduino import Arduino | |
import logging | |
import sys | |
board = Arduino(port='/dev/ttyACM0') | |
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) |
This file contains hidden or 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
storage_location_ids = server.model.stock.location.search([ | |
('type', '=', 'storage'), | |
('parent', 'child_of', location_ids)]) |
This file contains hidden or 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
{% macro form_error(key, errors) -%}{%- endmacro %} | |
{% macro form_input(key, values, errors=None, label=None, type='text') %} | |
<div class="form-group{{' error' if errors and key in errors else ''}}"> | |
<label class="form-label">{{ label or key.replace('_', ' ').title() }}</label> | |
<input type="{{ type }}" name="{{ key }}" | |
value="{{ values.get(key, '') }}" | |
class="form-control"> | |
{% form_error(key, errors) %} | |
</div> |
This file contains hidden or 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
sudo emerge --oneshot portage | |
* IMPORTANT: 6 news items need reading for repository 'gentoo'. | |
* Use eselect news to read news items. | |
Calculating dependencies... done! | |
[ebuild NS ] dev-lang/python-3.3.2-r2 [2.7.3-r2, 3.2.3] USE="gdbm ipv6 ncurses readline sqlite ssl threads xml -build -doc -examples -hardened -tk -wininst" | |
[ebuild U ] sys-apps/portage-2.2.7 [2.1.11.62] PYTHON_TARGETS="python3_3* -python3_2*" | |
[blocks B ] <sys-apps/sandbox-2.6-r1 ("<sys-apps/sandbox-2.6-r1" is hard blocking dev-lang/python-3.3.2-r2) |
This file contains hidden or 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
<div class="control-group"> | |
<span class="control-label">Field</span> | |
<div class="controls"> | |
<span class="help-inline">Value</span> | |
</div> | |
</div> |
This file contains hidden or 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
class TrytonServerWrapper(object): | |
def __init__(self, user_id, session_id, context, target): | |
self.user_id = user_id | |
self.session_id = session_id | |
self.context = context | |
self.target = target | |
def __call__(self, *args): | |
new_args = [self.user_id, self.session_id] |
This file contains hidden or 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
@ndb.transactional(xg=True) | |
def remove(self, new_rep_id=None): | |
# Un-assign this rep from all their stores. | |
stores = Store.query_stores(rep_id = self.key, active=None) | |
for store in stores: | |
store.rep_id = new_rep_id | |
store.put() | |
self.active = False | |
self.put() |
This file contains hidden or 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 pyramid.config import Configurator | |
def main(global_config, **settings): | |
""" This function returns a Pyramid WSGI application. | |
""" | |
config = Configurator(settings=settings) | |
config.add_static_view('static', 'static', cache_max_age=3600) | |
config.add_route('home', '{url:.*}') | |
config.scan() |
This file contains hidden or 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
app.config(function($routeProvider, $locationProvider, $httpProvider) { | |
// ... | |
$httpProvider.responseInterceptors.push(function ($q, $rootScope) { | |
return function (promise) { | |
$rootScope.$broadcast('startLoading'); | |
return promise.then(function (response) { | |
$rootScope.$broadcast('stopLoading'); | |
return response; | |
}, function (response) { | |
$rootScope.$broadcast('stopLoading'); |