Пример #1
0
def load_library(resources):
    """ Load textual resources given by command-line args 
  else all default.
  """
    if len(resources) > 0:
        import os
        for arg in resources:
            f = os.path.realpath(
                os.path.join(os.path.dirname(library.__file__),
                             "data/{}.bible.json".format(arg.upper())))
            library.load(f)
    else:
        # load everything we find
        library.load_resources()
    print "Loading into library:", library.list()
    # map to lowercase resource names
    return dict([(k.lower(), library.get(k)) for k in library.list()])
Пример #2
0
def load_library(resources):
  """ Load textual resources given by command-line args 
  else all default.
  """
  if len(resources) > 0:
    import os
    for arg in resources:
      f = os.path.realpath(
        os.path.join(os.path.dirname(library.__file__), 
          "data/{}.bible.json".format(arg.upper())))
      library.load(f)
  else:
    # load everything we find
    library.load_resources()
  print "Loading into library:", library.list()
  # map to lowercase resource names
  return dict([(k.lower(),library.get(k)) for k in library.list()])
Пример #3
0
import logging
import traceback

from django.shortcuts import render_to_response
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.http import Http404
from django.template import RequestContext
from django.utils.http import urlquote

from textbites import library

from tags.views import tag_search

library.load_resources()
log = logging.getLogger("nutritious." + __name__)


def lib(request):
    """ Library root.

  Also receives searches performed when no resource is selected.
  """
    query = request.GET.get('q', None)
    # generic library response
    if not query:
        return render_to_response('texts/library.html',
                                  {'resources': library.list()},
                                  context_instance=RequestContext(request))
    else:
Пример #4
0
import traceback

from django.shortcuts import render_to_response
from django.shortcuts import redirect
from django.core.urlresolvers  import reverse
from django.http import HttpResponseRedirect
from django.http import Http404
from django.template import RequestContext
from django.utils.http import urlquote

from textbites import library

from tags.views import tag_search


library.load_resources()
log = logging.getLogger("nutritious." + __name__)


def lib(request):
  """ Library root.

  Also receives searches performed when no resource is selected.
  """
  query = request.GET.get('q', None)
  # generic library response
  if not query:
    return render_to_response('texts/library.html', 
        {'resources': library.list()}, 
        context_instance=RequestContext(request))
  else: