Skip to content

Instantly share code, notes, and snippets.

@mazz
mazz / gist:22f92bd25c1f6f0314eca85d72e0ef7e
Created December 18, 2016 01:05
A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.
A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration.
Request URL:ws://localhost:40006/notebook/api/kernels/edca6a48-f31c-4317-bf36-d28dca6daf8b/channels?session_id=FFED1D8CD3B14AE68F92FFDD174C419B
Request Method:GET
Status Code:403 Forbidden
Response Headers
view source
Content-Length:4617
Content-Type:text/html
Date:Mon, 19 Dec 2016 01:38:17 GMT
Server:TornadoServer/4.4.2
from websauna.system.http import Request
from websauna.utils.slug import slug_to_uuid
from websauna.system.core.route import simple_route
from pyramid.request import Response
from pyramid.httpexceptions import HTTPNotFound
from . import models
@simple_route("/questions/{question_uuid}", route_name="detail", renderer="myapp/detail.html")
def detail(request):
# Convert base64 encoded UUID string from request path to Python UUID object
@mazz
mazz / views.py
Created January 7, 2017 05:09
sqlalchemy.orm.exc.DetachedInstanceError: Instance <Media at 0x10949c0b8> is not bound to a Session
from pyramid.httpexceptions import HTTPNotFound, HTTPFound
from websauna.utils.slug import uuid_to_slug
from websauna.utils.slug import slug_to_uuid
from websauna.system.core import messages
from websauna.system.http import Request
from websauna.system.core.route import simple_route
from .models import Media
import pafy
import transaction
@mazz
mazz / views.py
Created January 8, 2017 01:10
websauna mailer logs email sending as OK, never arrives. Confirmed postfix is working locally.
from pyramid.httpexceptions import HTTPNotFound, HTTPFound
from websauna.utils.slug import uuid_to_slug
from websauna.utils.slug import slug_to_uuid
from websauna.system.core import messages
from websauna.system.http import Request
from websauna.system.core.route import simple_route
from email.header import Header
from email.utils import formataddr
from websauna.system.mail import send_templated_mail
from .models import Media
@mazz
mazz / development.ini
Created January 8, 2017 01:32
hearit/conf/development.ini
# pserve and command line configuration for a local development machine
[includes]
include_ini_files =
resource://websauna/conf/development.ini
resource://hearit/conf/base.ini
resource://websauna/conf/base.ini
[app:main]
websauna.site_id = hearit_dev
@mazz
mazz / views.py
Created January 8, 2017 05:41
my_task.apply_async() not firing?
from pyramid.httpexceptions import HTTPNotFound, HTTPFound
from websauna.utils.slug import uuid_to_slug
from websauna.utils.slug import slug_to_uuid
from websauna.system.core import messages
from websauna.system.http import Request
from websauna.system.core.route import simple_route
from email.header import Header
from email.utils import formataddr
from websauna.system.mail import send_templated_mail
from .models import Media
@mazz
mazz / models.py
Created January 12, 2017 03:30
websauna admin does not detect audiostream table
"""Place your SQLAlchemy models in this file."""
import datetime
from uuid import uuid4
from sqlalchemy import Column, Unicode, String, Integer, ForeignKey, UnicodeText
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship
from websauna.system.model.meta import Base
@mazz
mazz / gist:353152b512c35f414622892471166073
Created January 22, 2017 01:21 — forked from miohtama/gist:0f64104fc8aefde8360f0c70cf46b950
SMS based login for React and Websauna app
"""
allows users to sign up and login with their phone number, if that number is assoicated with an
existing customer record.
"""
import logging
import colander
from cornice.service import Service
from pyramid.exceptions import HTTPBadRequest
from pyramid_sms.utils import normalize_us_phone_number
@mazz
mazz / views.py
Created January 22, 2017 01:46
NameError: name 'path' is not defined
from websauna.system.http import Request
from websauna.system.core.route import simple_route
from cornice.service import Service
# Configure view named home at path / using a template xact/home.html
@simple_route("/", route_name="home", renderer='xact/home.html')
def home(request: Request):
"""Render site homepage."""
return {"project": "xact"}