code
stringlengths
1
1.72M
language
stringclasses
1 value
import six from six.moves import builtins _property = builtins.property _tuple = builtins.tuple from operator import itemgetter as _itemgetter class TocPageset(tuple): 'TocPageset(label, pages)' __slots__ = () _fields = ('label', 'pages') def __new__(_cls, label, pages): 'Create new instance ...
Python
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import datetime import ast import logging try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict import six from six.moves import configparser class LayeredConfig(object): """Provide unifie...
Python
import six from six.moves import builtins _property = builtins.property _tuple = builtins.tuple from operator import itemgetter as _itemgetter class TocCriteria(tuple): """Represents a particular way of organizing the documents in a repository, for the purpose of generating a table of contents for those dou...
Python
from contextlib import contextmanager import shutil import os from tempfile import NamedTemporaryFile import filecmp import six if six.PY3: from urllib.parse import quote, unquote else: from urllib import quote, unquote # NOQA from ferenda import util from ferenda import errors class DocumentStore(object):...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals try: from collections import OrderedDict except ImportError: # if on python 2.6 from ordereddict import OrderedDict from collections import defaultdict from operator import attrgetter, itemgetter from datetime import date...
Python
# -*- coding: utf-8 -*- from __future__ import unicode_literals import sys import os import logging from rdflib import Graph from ferenda import TextReader, TripleStore from ferenda.elements import serialize class Devel(object): """This module acts as a docrepo (and as such is easily callable from ``ferenda-...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals from rdflib import Graph # Don't create instances of Document directly. Create them through # DocumentRepository.make_document in order to properly initialize the # .meta RDFLib Graph object. class Document(object): def __init__...
Python
#!/usr/bin/env python from setuptools import setup, find_packages import os,sys # seems this code is run for example when pip install runs? In that # case, these files don't exist. if os.path.exists("README.txt"): with open("README.txt") as fp: longdesc = fp.read() else: longdesc = "" if os.path.exis...
Python
#!/usr/bin/env python import sys import os from ferenda import manager if len(sys.argv) > 1 and sys.argv[1] == '-preflight': manager.preflight_check('http://localhost:8080/openrdf-sesame') else: if sys.argv[1] == '-force': sys.argv = sys.argv[1:] manager.setup(force=True) else: ma...
Python
from ferenda import elements, FSMParser def is_section(parser): chunk = parser.reader.peek() lines = chunk.split("\n") return (len(lines) == 2 and len(lines[0]) == len(lines[1]) and lines[1] == "=" * len(lines[0])) def is_preformatted(parser): chunk = parser.reader.peek() l...
Python
from ferenda.sources.tech import RFC, W3Standards from ferenda.manager import makeresources, frontpage, runserver, setup_logger from ferenda.errors import DocumentRemovedError, ParseError, FSMStateError config = {'datadir':'netstandards/exampledata', 'loglevel':'DEBUG', 'force':False, 's...
Python
from ferenda.sources import DocumentRepository class W3CStandards(DocumentRepository): alias = "w3c" start_url = "http://www.w3.org/TR/tr-status-all" document_url_regex = "http://www.w3.org/TR/(?P<year>\d{4})/REC-(?P<basefile>.*)-(?P<date>\d+)". parse_content_selector="body" parse_filter_selectors...
Python
from ferenda.sources import DocumentRepository class ExampleDocrepo(DocumentRepository): # Basic way, using RDFLib API def parse_metadata_from_soup(self,soup,doc): from rdflib import Namespace, Literal, URIRef, RDF title = "My Document title" # or find it using the BeautifulSoup object passed ...
Python
from ferenda.sources import DocumentRepository class RFCs(DocumentRepository): alias = "rfc" start_url = "http://www.ietf.org/download/rfc-index.txt" document_url_regex = "http://tools.ietf.org/rfc/rfc(?P<basefile>).txt" @recordlastdownload def download(self): self.log.debug("download: Star...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os,sys import codecs if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import six from ferenda import Citatio...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from ferenda import Devel class Main(unittest.TestCase): def...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals,print_function import sys, os if sys.version_info < (2, 7, 0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import codecs import re from ferenda.legalr...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import codecs import re from ferenda import FSMParser, TextReade...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2, 7, 0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from six import text_type as str from ferenda.manager import...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os,sys if sys.version_info < (2, 7, 0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from ferenda.manager import setup_logger; setup_logger('CRITIC...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import tempfile import shutil import os from datetime import date...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import time import subprocess import os import tempfile import ...
Python
# -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import json from ferenda import URIFormatter import ferenda.uriforma...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import rdflib #SUT from ferenda import Document class TestDocum...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from ferenda.manager import setup_logger; setup_logger('CRITICAL'...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys import os from datetime import datetime if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import six from ferenda impo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os,sys if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import codecs from ferenda.textreader import TextReader PREFIX ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from pyparsing import Word,nums from ferenda.citat...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys import tempfile import shutil import logging import hashlib import pkg_resources # NOTE: by inserting cwd (which *should* be the top-level source code # dir, with 'ferenda' and 'test' as subdirs) into sys.path a...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from ferenda.legaluri import construct,parse from ferenda.testuti...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) try: # assume we're on py3.3 and fall back if not from un...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import datetime try: # assume we're on py3.3 and fall back...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest # if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from ferenda.manager import setup_logger; setup_logger('CRITICA...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) import tempfile import shutil import time #SUT from ferenda imp...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info < (2,7,0): import unittest2 as unittest else: import unittest if os.getcwd() not in sys.path: sys.path.insert(0,os.getcwd()) from tempfile import mkdtemp import shutil from datetime import d...
Python
{'artal': '2004', 'lopnummer': '43', 'publikation': 'ad', 'type': 7}
Python
{'dnr': '1075-02-40', 'myndighet': 'jk', 'type': 8}
Python
{'artal': '2004', 'publikation': 'nja', 'sidnummer': '43', 'type': 7}
Python
{'chapter': '23', 'item': '4', 'law': '1960:729', 'piece': '1', 'section': '4', 'type': 1}
Python
{'law': '1998:204', 'type': 1}
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This is a WSGI handler for Apache Requires apache+mod_wsgi. In httpd.conf put something like: LoadMo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This is a handler for lighttpd+fastcgi This file has to be in the PYTHONPATH Put something like this in the...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ scgihandler.py - handler for SCGI protocol Modified by Michele Comitini <michele.comitini@glisco.it> from fcgihandler.py to support SCGI fcgihandler has the following copyright: " This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipi...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # when web2py is run as a windows service (web2py.exe -W) # it does not load the command line options but it # expects to find conifguration settings in a file called # # web2py/options.py # # this file is an example for options.py import socket import os ip = '0.0.0.0' po...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This file is based, although a rewrite, on MIT-licensed code from the Bottle web framework. """ import os,...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Usage: Install py2exe: http://sourceforge.net/projects/py2exe/files/ Copy script to the web2py directory c:\bin\python26\python build_windows_exe.py py2exe Adapted from http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/...
Python
#!/usr/bin/env python import os import sys """ Author: Christopher Steel on behalf of Voice of Access Copyright: Copyrighted (c) by Massimo Di Pierro (2007-2011) web2py_clone becomes part of the web2py distribution available on Pypi via 'pip install web2py' web2py_clone is one of multiple commands that become availa...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys path = os.getcwd() try: if sys.argv[1] and os.path.exists(sys.argv[1]): path = sys.argv[1] except: pass os.chdir(path) sys.path = [path]+[p for p in sys.path if not p==path] # import gluon.import_all ##### This should be uncommented f...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) The widget is called from web2py. """ import sys import cStringIO import time import thread import re impo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # portalocker.py - Cross-platform (posix/nt) API for flock-style file locking. # Requires python 1.5.2 or better. """ Cross-platform (posix/nt) API for flock-style file locking. Synopsis: import portalocker file = open(\"somefile\", \"r+\") port...
Python
""" This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ from storage import Storage global_settings = Storage() settings = global_settings # legacy compatibility
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ __all__ = ['HTTP', 'redirect'] defined_status = { 200: 'OK', 201: 'CREATED', 202: 'ACCEPTE...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>, limodou <limodou@gmail.com> and srackham <srackham@gmail.com>. License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ import logging import os import pdb impo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This file specifically includes utilities for security. """ import hashlib import hmac import uuid import ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Provides: - List; like list but returns None instead of IndexOutOfBounds - Storage; like dictionary allowi...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ import re # pattern to find defined tables regex_tables = re.compile(\ """^[\w]+\.define_table\(\...
Python
#!/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Thanks to * Niall Sweeny <niall.sweeny@fonjax.com> for MS SQL support * Marcel Leuthi <mluethi@mlsystem...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import __builtin__ import os import re import sys import threading # Install the new import function: def custom_import_install(web2py_path): global _web2py_importer global _web2py_path if isinstance(__builtin__.__import__, _Web2pyImporter): return #ar...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Basic caching classes and methods ================================= - Cache - The generic caching object i...
Python
#!/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Contains: - wsgibase: the gluon wsgi application """ import gc import cgi import cStringIO import Cookie imp...
Python
# this file exists for backward compatibility __all__ = ['DAL','Field','drivers'] from dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, drivers, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ :: # from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496942 # Title: Cross-site scripting (XSS) defense # Submitter: Josh Goldfoot (other recipes) # Last Updated: 2006/08/05 # Version no: 1.0 """ from htmllib import HTMLParser from ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created by Attila Csipa <web2py@csipa.in.rs> Modified by Massimo Di Pierro <mdipierro@cs.depaul.edu> """ import sys import os import threading import logging import time import sched import re import datetime import platform import portalocker import fileutils import ...
Python
#### WORK IN PROGRESS... NOT SUPPOSED TO WORK YET USAGE = """ ## Example For any existing app Create File: app/models/scheduler.py ====== from gluon.scheduler import Scheduler def demo1(*args,**vars): print 'you passed args=%s and vars=%s' % (args, vars) return 'done!' def demo2(): 1/0 scheduler = Sch...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework (Copyrighted, 2007-2011). License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Author: Thadeus Burgess Contributors: - Thank you to Massimo Di Pierro for creating the original gluon/template.py - Thank you to Jonathan...
Python
import codecs, encodings """Caller will hand this library a buffer and ask it to either convert it or auto-detect the type. Based on http://code.activestate.com/recipes/52257/ Licensed under the PSF License """ # None represents a potentially variable byte. "##" in the XML spec... autodetect_dict={ # bytepattern ...
Python
# encoding utf-8 __author__ = "Thadeus Burgess <thadeusb@thadeusb.com>" # we classify as "non-reserved" those key words that are explicitly known # to the parser but are allowed as column or table names. Some key words # that are otherwise non-reserved cannot be used as function or data type n # ames and ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>, limodou <limodou@gmail.com> and srackham <srackham@gmail.com>. License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ import os import sys import code import ...
Python
# -*- coding: utf-8 -*- # This file is part of the Rocket Web Server # Copyright (c) 2011 Timothy Farrell # Import System Modules import sys import errno import socket import logging import platform import traceback # Define Constants VERSION = '1.2.4' SERVER_NAME = socket.gethostname() SERVER_SOFTWARE = 'Rocket %s'...
Python
#!/bin/python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ import base64 import cPickle import datetime import thread import logging import sys import glob import os impo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Functions required to execute app components ============================================ FOR INTERNAL USE...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) CONTENT_TYPE dictionary created against freedesktop.org' shared mime info database version 0.70. """ __all...
Python
#!/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) gluon.rewrite parses incoming URLs and formats outgoing URLs for gluon.html.URL. In addition, it rewrites both...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ from SimpleXMLRPCServer import SimpleXMLRPCDispatcher def handler(request, response, methods): re...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu> and Limodou <limodou@gmail.com>. License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This makes uses of the pywin32 package (http://sourceforge.net/projects/pywin...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) """ import cgi import os import re import copy import types import urllib import base64 import sanitizer im...
Python
""" Extract client information from http user agent The module does not try to detect all capabilities of browser in current form (it can easily be extended though). Aim is * fast * very easy to extend * reliable enough for practical purposes * and assist python web apps to detect clients. Taken from h...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 3, or (at your option) any later # version. # # This program is distributed in the...
Python
#!/usr/bin/env python """Universal feed parser Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds Visit http://feedparser.org/ for the latest version Visit http://feedparser.org/docs/ for the latest documentation Required: Python 2.4 or later Recommended: CJKCodecs and iconv_codec <http://cjkpytho...
Python
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <allan@saddi.com> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # noti...
Python
#!/usr/bin/env python # coding: utf8 """ RPX Authentication for web2py Developed by Nathan Freeze (Copyright © 2009) Email <nathan@freezable.com> Modified by Massimo Di Pierro This file contains code to allow using RPXNow.com (now Jainrain.com) services with web2py """ import os import re import ur...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of web2py Web Framework (Copyrighted, 2007-2009). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>. License: GPL v2 Thanks to Hans Donner <hans.donner@pobox.com> for GaeGoogleAccount. """ from google.appengine.api import users class GaeGoog...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of web2py Web Framework (Copyrighted, 2007-2009). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>. License: GPL v2 Thanks to Hans Donner <hans.donner@pobox.com> for GaeGoogleAccount. """ from gluon.http import HTTP try: import linkedin...
Python
#!/usr/bin/env python # coding: utf8 """ Dropbox Authentication for web2py Developed by Massimo Di Pierro (2011) Same License as Web2py License """ # mind here session is dropbox session, not current.session import os import re import urllib from dropbox import client, rest, session from gluon import * fro...
Python
# -*- coding: utf-8 -*- # # last tinkered with by szimszon at oregpreshaz.eu on 2012-03-19 # import sys import logging try: import ldap import ldap.filter ldap.set_option( ldap.OPT_REFERRALS, 0 ) except Exception, e: logging.error( 'missing ldap, try "easy_install python-ldap"' ) raise e def ldap...
Python
#!/usr/bin/env python # coding: utf8 """ OpenID authentication for web2py Allowed using OpenID login together with web2py built-in login. By default, to support OpenID login, put this in your db.py >>> from gluon.contrib.login_methods.openid_auth import OpenIDAuth >>> auth.settings.login_form = ...
Python
#!/usr/bin/env python # coding: utf8 """ ExtendedLoginForm is used to extend normal login form in web2py with one more login method. So user can choose the built-in login or extended login methods. """ from gluon import current, DIV class ExtendedLoginForm(object): """ Put extended_login_form under web2py/gl...
Python
import urllib import urllib2 import base64 def basic_auth(server="http://127.0.0.1"): """ to use basic login with a different server from gluon.contrib.login_methods.basic_auth import basic_auth auth.settings.login_methods.append(basic_auth('http://server')) """ def basic_login_aux(username, ...
Python
#!/usr/bin/env python import time from hashlib import md5 from gluon.dal import DAL def motp_auth(db=DAL('sqlite://storage.sqlite'), time_offset=60): """ motp allows you to login with a one time password(OTP) generated on a motp client, motp clients are available for practica...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Written by Michele Comitini <mcm@glisco.it> License: GPL v3 Adds support for x509 authentication. """ from gluon.globals import current from gluon.storage import Storage from gluon.http import HTTP,redirect #requires M2Crypto from M2Crypto import X509 class X509...
Python
from gluon.contrib.pam import authenticate def pam_auth(): """ to use pam_login: from gluon.contrib.login_methods.pam_auth import pam_auth auth.settings.login_methods.append(pam_auth()) or auth.settings.actions_disabled=[ 'register','change_password','request_reset_password'] auth....
Python
import smtplib import logging def email_auth(server="smtp.gmail.com:587", domain="@gmail.com", tls_mode=None): """ to use email_login: from gluon.contrib.login_methods.email_auth import email_auth auth.settings.login_methods.append(email_auth("smtp.gmail.com:587", ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of web2py Web Framework (Copyrighted, 2007-2009). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>. License: GPL v2 Tinkered by Szabolcs Gyuris < szimszo n @ o regpreshaz dot eu> """ from gluon import current, redirect class CasAuth( object...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Loginza.ru authentication for web2py Developed by Vladimir Dronnikov (Copyright © 2011) Email <dronnikov@gmail.com> """ import urllib from gluon.html import * from gluon.tools import fetch from gluon.storage import Storage import gluon.contrib.simplejson as j...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Written by Michele Comitini <mcm@glisco.it> License: LGPL v3 Adds support for OAuth 2.0 authentication to web2py. OAuth 2.0 Draft: http://tools.ietf.org/html/draft-ietf-oauth-v2-10 """ import time import cgi import urllib2 from urllib import urlencode from gluon ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Written by Michele Comitini <mcm@glisco.it> License: GPL v3 Adds support for OAuth1.0a authentication to web2py. Dependencies: - python-oauth2 (http://github.com/simplegeo/python-oauth2) """ import oauth2 as oauth import cgi from urllib2 import urlopen import ur...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of web2py Web Framework (Copyrighted, 2007-2009). Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu> and Robin B <robi123@gmail.com>. License: GPL v2 """ __all__ = ['MEMDB', 'Field'] import re import sys import os import types import datetime ...
Python
# Only Python 2.6 and up, because of NamedTuple. import time from collections import namedtuple Score = namedtuple('Score', ['tag', 'stamp']) class TimeCollector(object): def __init__(self): '''The first time stamp is created here''' self.scores = [Score(tag='start',stamp=time.clock())] def add...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """`cssmin` - A Python port of the YUI CSS compressor.""" """ Home page: https://github.com/zacharyvoase/cssmin License: BSD: https://github.com/zacharyvoase/cssmin/blob/master/LICENSE Original author: Zachary Voase Modified for inclusion into web2py by: Ross Peoples <ros...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ High-level CSS and JS minification class for web2py. Called by response.include_files() Created by: Ross Peoples <ross.peoples@gmail.com> Modified by: Massimo Di Pierro <massimo.dipierro@gmail.com> """ import cssmin import jsmin import os def read_binary_file(filenam...
Python