Skip to content

Instantly share code, notes, and snippets.

View mmulich's full-sized avatar

Michael Mulich mmulich

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html> <!-- This is required in HTML5 -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lrmi="http://lrmi.net/the-specification"
>
<!-- For EPUB parsing/validation python should only care about data-* attributes.
Other attributes are for discoverability and compatibility with schema.org . -->
diff --git a/cnxpublishing/db.py b/cnxpublishing/db.py
index d702f41..eeb1c77 100644
--- a/cnxpublishing/db.py
+++ b/cnxpublishing/db.py
@@ -103,6 +103,17 @@ update pending_documents set license_accepted = 't'
where id = %s""", (document_id,))
+def add_pending_resource(cursor, resource):
+ """Adds a pending resource to the database."""
{'contents': [{'contents': [{'contents': [{'id': '3ed0b04d-51e8-4b4d-b155-51f14c34dfe9@3.xhtml',
'title': 'Document One'}],
'id': 'subcol',
'title': u'Chapter One'},
{'contents': [{'id': 'e78d4f90-e078-49d2-beac-e95e8be70667@4.xhtml',
'title': 'Document One (revised)'}],
'id': 'subcol',
'title': u'Chapter Two'}],
'id': 'subcol',
'title': u'Part One'},
@mmulich
mmulich / a163b66c@draft.xhtml
Last active August 29, 2015 13:58
e78d4f90-e078-49d2-beac-e95e8be70667@3.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:epub="http://www.idpf.org/2007/ops"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lrmi="http://lrmi.net/the-specification"
>
<head itemscope="itemscope"
itemtype="http://schema.org/Book"
>
[coyote]
# These queue to runner mappings (<queue_name>:<runner_name>) propulate the
# queues list to run through during runtime.
queue-mappings =
cnx_any_latex_completezip:completezip
[amqp]
host = localhost
port = 5672
@mmulich
mmulich / authoring-acceptance-plan.rst
Last active August 29, 2015 14:07
Plan for implementing role/license acceptance in authoring

Story Workflow

content creation auto acceptance
  1. UI: 'arthur' creates content
  2. Authoring: object created & auto accepts role/license for 'arthur'
  3. Authoring: communication with publishing to set 'arthur' to accepted
adding a role to content
  1. UI: 'arthur' adds 'smoo' to the content as both an editor and illustrator
@mmulich
mmulich / roles.sql
Last active August 29, 2015 14:09
authoring roles and acceptances database tables
create table roles(
id integer unique sequence,
document_id uuid,
role_type role_types, -- e.g. author, illustrator
user_id text, -- username as it appears in accounts
profile json, -- a copy of the user's profile json
has_accepted boolean,
requester text,
assignment_data timestamp with timezone default current_timestamp,
primary key (document_id, role_type, user_id),
@mmulich
mmulich / testcase.py
Last active August 29, 2015 14:09
Non-conflicting pyramid applications using wsgi_intercept
from pyramid.config import (
global_registries,
ApplicationCreated,
Configurator as BaseConfigurator,
)
from pyramid.threadlocal import (
defaults as threadlocal_defaults,
manager as actual_threadlocal_manager,
ThreadLocalManager,
)

/api/user.json before editing title:

{
id: 40620,
username: "MichaelMulich",
first_name: "Michael",
last_name: "Mulich",
full_name: "Michael Mulich"
# -*- coding: utf-8 -*-
"""\
Symbolically links a virtualenv's site-packages to
the globaly Python's user site-packages directory.
This should be run with the global Python.
"""
import os
import site