Skip to content

Instantly share code, notes, and snippets.

@JoeyCodinja
JoeyCodinja / __init__.py
Created March 22, 2016 23:53
Not able to view Tables from SQLAlchemy Mapping with Pyramid_SACRUD
from pyramid.config import Configurator
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid_redis_sessions import session_factory_from_settings
from pyramid.security import (
Allow,
Authenticated,
ALL_PERMISSIONS,
)
from pyramid_sacrud import PYRAMID_SACRUD_HOME
@JoeyCodinja
JoeyCodinja / buildout.cfg
Created December 15, 2016 15:13
Faulty buildout trying to load bda.plone.shop as an add-on
############################################
#
# Buildout Configuration File for Plone
# -------------------------------------
#
# ALWAYS back up all Plone/Zope data and components
# before changing configuration.
#
# Running "bin/buildout" will update your installation,
# installing missing components as necessary.
@JoeyCodinja
JoeyCodinja / gist:35a89b9af0596a3d7223b65701b746fd
Last active September 28, 2020 13:45
Fetch Script for Policies omitting vehicle registration number
from django.db.models import Q
query = Q(quotation__vehicle__license_plate="") | Q(quotation__vehicle__license_plate=None)
POLICYS_IN_QUESTION = Policy.objects.filter(query)
f = open('cert-no-show-reg-number.txt', 'w')
for policy in POLICYS_IN_QUESTION:
f.write("== {} ==\n".format(policy.policy_number))
try:
quotation_vehicle = policy.quotation.vehicle
risk_vehicle = policy.risk.vehicle
{"key": "cFGrpnzlJWPi+Oh6TTz76JvedEZZjAidX/YSHzTgCYpy7xqk0CMTf8hbjCOmpjwPuEPIrag6T8dhvnhNdNBHQ+RPKwchLuwpk+pGdgvfJdONOvTt1A8tEN7DGH4fuyzr1lU+1sgouJpkGtl+EO3hGoCyOXPyMP+Vbp6UKyYRFBRQpkIXfaO2JgFcilO3alz4LXQ8uICkULmI8Rs12NdKz4DyKZJvYanxYCQPW+ZQ1bmIXETZVR/tBHbDgFjRqWDomY0Gzr+6QkHaiRTLDNPvtVoLUI6RN6W2gr2Q1XV44fw4An4PC+2EIp2f7hYcdA7TlGBBn6lZu8ChMOs0FaiX+g==",
"kid": 491812,
"policy_data": [{"cover": [{"certificate": {"authorized_drivers_wording": "",
"cancelled": False,
"cancelled_by_plain_text": "",
"cancelled_on_at": "",
"cancelled_reason": "",
"certificate_no": "",
"certificate_type": "",
"chassis_number": "ASD309812982",