Copyright (C) 2018 Robert Rottermann redO2oo.ch
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
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
<?xml version="1.0" encoding="utf-8"?> | |
<odoo> | |
<data noupdate="1"> | |
<!-- Sequences for asset.movement --> | |
<record id="seq_mov_returns" model="ir.sequence"> | |
<field name="name">Assets Movement Returns</field> | |
<field name="code">asset.movement.return</field> | |
<field name="prefix"></field> | |
<field name="padding">4</field> | |
<!-- <field name="company_id" eval="False"/> --> |
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
write(vals) | |
Updates all records in the current set with the provided values. | |
:param dict vals: fields to update and the value to set on them e.g:: | |
{'foo': 1, 'bar': "Qux"} | |
will set the field ``foo`` to ``1`` and the field ``bar`` to | |
``"Qux"`` if those are valid (otherwise it will trigger an error). | |
:raise AccessError: * if user has no write rights on the requested object | |
* if user tries to bypass access rules for write on the requested object | |
:raise ValidateError: if user tries to enter invalid value for a field that is not in selection | |
:raise UserError: if a loop would be created in a hierarchy of objects a result of the operation (such as setting an object as its own parent) |
For the lesson today, we are going to deploy our application to a live server.
The current workspace provided by cloud9 is meant only for development and not for production. By that, we mean you can use the service to write and even test your code but not to run your service.
For this we will be using a platform called heroku. Heroku is a PAAS (Platform As A Service).
This means you will not need to work VMs and such. Heroku will work with your code as long as you push it, which do using a similar technique.
The main things to consider when hosting your code will be:
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
[packages] | |
flask = "*" | |
flask-sqlalchemy = "*" | |
"psycopg2" = "*" | |
gunicorn = "*" | |
[requires] |
This is an unofficial manual for the couchdb
Python module I wish I had had.
pip install couchdb
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#INSTALL FLASK WITH: pip install Flask | |
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/saludo', methods=['GET']) | |
def hello(): |
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
{% with messages = get_flashed_messages(with_categories=true) %} | |
<!-- Categories: success (green), info (blue), warning (yellow), danger (red) --> | |
{% if messages %} | |
{% for category, message in messages %} | |
<div class="alert alert-{{ category }} alert-dismissible" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<!-- <strong>Title</strong> --> {{ message }} | |
</div> | |
{% endfor %} | |
{% endif %} |
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
def file_to_base64(file_path): | |
""" | |
A simple function which accepts the file_path and | |
converts and returns base64 string if specified file | |
exists. Returns blank string '' if file is not found. | |
""" | |
from os import path | |
if not path.exists(file_path): | |
return '' | |
return open(file_path, 'rb').read().encode('base64') |
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
//http://stackoverflow.com/questions/15877362/declare-and-initialize-a-dictionary-in-typescript | |
interface IDictionary { | |
add(key: string, value: any): void; | |
remove(key: string): void; | |
containsKey(key: string): bool; | |
keys(): string[]; | |
values(): any[]; | |
} |