Skip to content

Instantly share code, notes, and snippets.

View rich-hart's full-sized avatar

Rich Hart rich-hart

View GitHub Profile
@rich-hart
rich-hart / install.sh
Created February 24, 2015 17:04
unittest_report
#!/bin/bash
mkdir development
cd development
virtualenv .
git clone https://github.com/Connexions/cnx-query-grammar.git
cd cnx-query-grammar && ../bin/python setup.py install && cd ..
git clone https://github.com/Connexions/cnx-epub.git
@rich-hart
rich-hart / psql_output
Created February 24, 2015 18:10
virtualenv linking notes
$ psql -U postgres
psql (9.4.1)
Type "help" for help.
postgres=# do language plpythonu $$import cnxarchive; import plpy; plpy.info(cnxarchive.__file__)$$;
ERROR: language "plpythonu" does not exist
HINT: Use CREATE LANGUAGE to load the language into the database.
@rich-hart
rich-hart / original_sql_query.sql
Last active August 29, 2015 14:16
taken from cnx-publishing/cnxpublishing/publish.py
WITH abstract_insertion AS (
INSERT INTO abstracts (abstractid, abstract, html)
VALUES (DEFAULT, NULL, %(summary)s)
RETURNING abstractid),
license_lookup AS (
SELECT licenseid
FROM licenses
WHERE url = %(license_url)s),
module_insertion AS (
INSERT INTO modules
2015-03-13 10:08:32,796 ERROR [waitress][Dummy-1] Exception when serving /publications
Traceback (most recent call last):
File "/opt/beta/local/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/channel.py", line 337, in service
task.service()
File "/opt/beta/local/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/task.py", line 173, in service
self.execute()
File "/opt/beta/local/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/task.py", line 392, in execute
app_iter = self.channel.server.application(env, start_response)
File "/opt/beta/local/lib/python2.7/site-packages/pyramid-1.5.2-py2.7.egg/pyramid/router.py", line 242, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
@rich-hart
rich-hart / unit_test.py
Created March 18, 2015 19:42
Authoring unit test fails
======================================================================
FAIL: test_delete_after_publish (cnxauthoring.tests.test_functional.PublicationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/openstax/workspace/openstax_scripts/development/cnx-authoring/cnxauthoring/tests/test_functional.py", line 3444, in test_delete_after_publish
self.assertEqual(publish['state'], 'Done/Success')
AssertionError: u'Waiting for moderation' != 'Done/Success'
======================================================================
FAIL: test_edit_after_publish (cnxauthoring.tests.test_functional.PublicationTests)
/opt/cnx-buildout/var/log
legacy cite
2015-03-26 13:15:12,647 DEBUG [cnxpublishing][Dummy-1] debug_authorization of url http://localhost:6543/contents/72e2a219-72b0-4167-a10d-fe09fea913c5/permissions (view name u'' against context <cnxpublishing.RootFactory object at 0x7fb03ca79090>): Allowed (no permission registered)
authoring:
127.0.0.1 - - [26/Mar/2015:13:15:12 -0500] "PUT /contents/72e2a219-72b0-4167-a10d-fe09fea913c5%40draft.json HTTP/1.0" 200 1925 "http://dev.cnx.org/contents/72e2a219-72b0-4167-a10d-fe09fea913c5@draft:2/Test_Book_3-26" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36"
2015-03-26 13:15:22,489 INFO [requests.packages.urllib3.connectionpool][Dummy-3] Starting new HTTP connection (1): localhost
@rich-hart
rich-hart / archive_db_commands.sql
Last active August 29, 2015 14:17
Book not publishing in Legacy Publishing Issue #99
SELECT * FROM modules WHERE uuid='b82c2559-d091-42f5-9413-6123b31a1765';
@rich-hart
rich-hart / .pdbrc
Last active August 29, 2015 14:18
Python debugger startup script. Place both test.sh and .pdbrc files in the root path of you python project. In this case it would the be cnx-authoring dir.
# Add cnx directories to sys.path so the debugger can start up with breakpoints inside of modules.
import sys
sys.path.append('/Users/openstax/workspace/openstax_scripts/development/cnx-authoring')
sys.path.append('/Users/openstax/workspace/openstax_scripts/development/cnx-authoring/cnxauthoring/tests')
sys.path.append('/Users/openstax/workspace/openstax_scripts/development/cnx-authoring/cnxauthoring')
b utils:404
b views:421
@rich-hart
rich-hart / search.sh
Created April 14, 2015 17:48
Search Results Data
curl http://tundra.cnx.rice.edu:6543/search?q=subject:%22Science%20and%20Technology%22 > sci_tech_search.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 355k 100 355k 0 0 4135 0 0:01:28 0:01:28 --:--:-- 99107
curl http://tundra.cnx.rice.edu:6544/search?q=subject:"Social%20Sciences" > social_sciences.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 219k 100 219k 0 0 3715 0 0:01:00 0:01:00 --:--:-- 53541
@rich-hart
rich-hart / tesh.sh
Last active August 29, 2015 14:20
testing script for karen vm install
python setup.py test -s cnxauthoring.tests.test_utils
python setup.py test -s cnxauthoring.tests.test_views
python setup.py test -s cnxauthoring.tests.test_modifiers
python setup.py test -s cnxauthoring.tests.test_schemata
python setup.py test -s cnxauthoring.tests.test_utils
python -m unittest discover -s .
# it seems that its reading the file mock-1.0.1-py2.7.egg as a module but can't find it in the loaded modules.
# also the tests/interpet.py needs to moved out of directory or else error will be thrown.