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
from sqlalchemy.orm.session import SessionExtension | |
class DatasetActivitySessionExtension(SessionExtension): | |
def before_commit(self, session): | |
session.flush() | |
try: | |
obj_cache = session._object_cache | |
revision = session.revision |
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 | |
import urlparse | |
import mimetypes | |
import os | |
import ConfigParser | |
import urllib2 | |
import json | |
import csv | |
import time |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
</head> | |
<body> | |
<h1>mooooooooooooooooooooooooooooooo</h1> | |
</body> |
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
* example of how to provide the data according to the new vocabulary version | |
{ | |
"id": "32d432-42342-42342242", # our id not allowed on create, has to be supplied on update | |
"name": "dataset-name", # madatory and has restrictions to [a-zA-Z1-9-_]* | |
"title": "dataset title", # if empty same as name | |
"alternative_title": "alternative title", | |
"description": "long description", | |
"keyword_string": "keyword1, keyword2, keyword2", # comma seperated keywords |
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
server { | |
listen 80 default; | |
server_name localhost; | |
access_log /var/log/nginx/localhost.access.log; | |
location / { | |
# location of apache or ckan under paster | |
proxy_pass http://127.0.0.1:8080; | |
proxy_set_header Host $host; |
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
<VirtualHost *:80> | |
ServerName test.ckan.org | |
ServerAlias test.ckan.org localhost | |
#Drupal instance | |
DocumentRoot /var/www/drupal | |
DirectoryIndex index.phtml index.html index.php index.htm | |
# CKAN lives under /data | |
WSGIScriptAlias /data /dir/to/wsgi.py |
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 site_read(context, data_dict=None): | |
model = context['model'] | |
user = context['user'] | |
userobj = model.User.get( user ) | |
if userobj: | |
return {'success': True} | |
return {'success': False, 'msg': 'You must be logged in see the site'} | |
class YourExtension(SigletonPlugin): |
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
import sqlalchemy | |
import uuid | |
_engines = {} | |
_pg_types = {} | |
def get_engine(context, data_dict): | |
db_name = data_dict.get('db_name', 'main') | |
engine = _engines.get(db_name) |
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
import requests | |
import time | |
import glob | |
result = glob.glob('/home/david/Downloads/json/*') | |
def run_documents(): | |
for document in result: | |
print document |
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
import os | |
import sys | |
import pkg_resources | |
import paste.script.appinstall | |
from paste.deploy import loadapp | |
import paste.fixture | |
import time | |
import csv | |
import cProfile | |
import requests |
OlderNewer