# Path: src/sa_web/config.py
# def get_shareabouts_config(path_or_url):
#     if path_or_url.startswith('http://') or path_or_url.startswith('https://'):
#         return ShareaboutsRemoteConfig(path_or_url)
#     else:
#         return ShareaboutsLocalConfig(path_or_url)


import dateutil.parser
import requests
import yaml
import ujson as json
import logging
import os
import time
import hashlib
import httpagentparser
from .config import get_shareabouts_config
from django.shortcuts import render
from django.conf import settings
from django.core.cache import cache
from django.core.mail import EmailMultiAlternatives
from django.http import HttpResponse, Http404
from django.template import TemplateDoesNotExist, RequestContext
from django.template.loader import render_to_string
from django.utils.timezone import now
from django.views.decorators.csrf import ensure_csrf_cookie
from django.core.urlresolvers import resolve, reverse
from proxy.views import proxy_view as remote_proxy_view
    if place_id and place_id != 'new':
        place = api.get('places/' + place_id)
        if place:
            place = json.loads(place)

    context = {'config': config,

               'user_token_json': user_token_json,
               'pages_config': pages_config,
               'pages_config_json': pages_config_json,
               'user_agent_json': user_agent_json,
               # Useful for customized meta tags
               'place': place,

               'API_ROOT': api.root,
               'DATASET_ROOT': api.dataset_root,
               }

    return render(request, 'index.html', context)


def place_was_created(request, path, response):
    path = path.strip('/')
    return (
        path.startswith('places') and
        not path.startswith('places/') and
        response.status_code == 201)


def send_place_created_notifications(request, response):

# Path: src/sa_web/config.py
# def get_shareabouts_config(path_or_url):
#     if path_or_url.startswith('http://') or path_or_url.startswith('https://'):
#         return ShareaboutsRemoteConfig(path_or_url)
#     else:
#         return ShareaboutsLocalConfig(path_or_url)


# Path: src/sa_web/views.py
import dateutil.parser
import requests
import yaml
import ujson as json
import logging
import os
import time
import hashlib
import httpagentparser
from .config import get_shareabouts_config
from django.shortcuts import render
from django.conf import settings
from django.core.cache import cache
from django.core.mail import EmailMultiAlternatives
from django.http import HttpResponse, Http404
from django.template import TemplateDoesNotExist, RequestContext
from django.template.loader import render_to_string
from django.utils.timezone import now
from django.views.decorators.csrf import ensure_csrf_cookie
from django.core.urlresolvers import resolve, reverse
from proxy.views import proxy_view as remote_proxy_view

    if place_id and place_id != 'new':
        place = api.get('places/' + place_id)
        if place:
            place = json.loads(place)

    context = {'config': config,

               'user_token_json': user_token_json,
               'pages_config': pages_config,
               'pages_config_json': pages_config_json,
               'user_agent_json': user_agent_json,
               # Useful for customized meta tags
               'place': place,

               'API_ROOT': api.root,
               'DATASET_ROOT': api.dataset_root,
               }

    return render(request, 'index.html', context)


def place_was_created(request, path, response):
    path = path.strip('/')
    return (
        path.startswith('places') and
        not path.startswith('places/') and
        response.status_code == 201)


def send_place_created_notifications(request, response):

    config = get_shareabouts_config(settings.SHAREABOUTS.get('CONFIG'))