def create_render(privilege): if logged(): if privilege == 1: render = render_mako( directories=['templates/admin'], input_encoding='utf-8', output_encoding='utf-8', ) elif privilege == 2: render = render_mako( directories=['templates/manager'], input_encoding='utf-8', output_encoding='utf-8', ) elif privilege == 3: render = render_mako( directories=['templates/organizer'], input_encoding='utf-8', output_encoding='utf-8', ) else: render = render_mako( directories=['templates'], input_encoding='utf-8', output_encoding='utf-8', ) return render
def __init__(self): self.mako_render = render_mako( directories=[self.templates_path, ], input_encoding='utf-8', output_encoding='utf-8' ) self.kw = web.input() # remove for test
def Configure(template_dirs, module_cache_dir = '/tmp/'): globals()['LOOKUP'] = render_mako( directories = template_dirs, module_directory = module_cache_dir, output_encoding = 'utf-8', filesystem_checks = True )
def load_ctx(handler): web.ctx.render = render_mako( directories = [os.path.join(os.path.dirname(__file__), 'templates')], input_encoding='utf-8', output_encoding='utf-8') return handler()
def GET(self): render = render_mako( directories=['templates'], input_encoding=u'utf-8', output_encoding=u'utf-8',) mlist = [unicode(chr(x)) for x in range(65, 91)] return render.mako(title=u'テストタイトル', olist=mlist)
def GET(self): print "Testing ebook2" render = render_mako( directories=['ebooks/ebook2'], input_encoding='utf-8', output_encoding='utf-8', ) return render.ebook2()
def create_render(is_superuser): render=None if logged(): if is_superuser == 1: render = render_mako( directories=['templates'], input_encoding='utf-8', output_encoding='utf-8', ) else: render = render_mako( directories=['templates'], input_encoding='utf-8', output_encoding='utf-8', ) else: render = render_mako( directories=['templates'], input_encoding='utf-8', output_encoding='utf-8', ) return render
''' import os, sys, web, base64, getopt from os import path from web.contrib.template import render_mako import utils from mgr import * cfg = utils.getcfg(['cves.conf', '/etc/cves.conf']) web.config.cfg = cfg DEBUG = not path.isfile('RELEASE') web.config.debug = DEBUG web.config.rootdir = path.dirname(__file__) web.config.db = web.database(**dict(cfg.items('db'))) web.config.render = render_mako( directories = ['templates'], imports = ['import web'], default_filters = ['decode.utf8'], filesystem_checks = DEBUG, module_directory = None if DEBUG else '/tmp/mako_modules', input_encoding = 'utf-8', output_encoding = 'utf-8') def serve_file(filepath): class ServeFile(object): def GET(self): with open(filepath, 'rb') as fi: return fi.read() return ServeFile def serve_path(dirname): class ServePath(object): def GET(self, p): with open(path.join(dirname, p), 'rb') as fi: return fi.read()
NET_STATE_CONNECTED = 1 lang_code = locale.getdefaultlocale()[0] if lang_code == 'zh_CN': DEFAULT_LANG = 'zh_CN' else: DEFAULT_LANG = 'en_US' lang_in_use = None gettext.install('messages', localedir, unicode=True) gettext.translation('messages', localedir, languages=[DEFAULT_LANG]).install(True) render = render_mako(directories=['templates'], output_encoding='utf-8', input_encoding='utf-8', default_filters=['decode.utf8']) app = web.application(urls, globals()) SEAFILE_VERSION = '1.7.0' default_options = { "confdir": CCNET_CONF_PATH, 'web_ctx': web.ctx, 'seafile_version': SEAFILE_VERSION, 'lang': DEFAULT_LANG, 'settings': settings, } def get_relay_of_repo(repo): if not repo: return None
def __init__(self): self.render = render_mako(directories=["views"], input_encoding="utf-8", output_encoding="utf-8")
import sys, os reload(sys) sys.setdefaultencoding('utf-8') sys.path.append(os.path.dirname(os.path.abspath(__file__))) import web import random from web.contrib.template import render_mako from mako import exceptions as mako_exceptions from enabled import active_pages cwd = os.path.dirname(os.path.abspath(__file__)) urls = ('/(.*)', 'main') render = render_mako( directories=[os.path.join(cwd, 'templates')], input_encoding='utf-8', output_encoding='utf-8', ) random_images = [ { 'link': '/electricalily', 'src': '/static/images/text_small.jpg', }, { 'link': '/electricalily', 'src': '/static/images/board_small.jpg', }, { 'link': '/electricalily', 'src': '/static/images/pwmcloseup_small.jpg',
from models import Entry, Category from google.appengine.ext import ndb from google.appengine.api import users import re urls = ( '/admin/?$', 'index', '/admin/list/(\w+)/?$', 'list', '/admin/create/(\w+)/?$', 'create', '/admin/edit/(.*)/?$', 'update', '/admin/delete/(.*)/?$', 'delete' ) render = render_mako( directories=['templates/shared', 'templates/admin'], input_encoding='utf-8', output_encoding='utf-8' ) app = web.application(urls, globals()) app = app.gaerun() def create_form(entity): #todo: proper validation for tags if entity.__class__.__name__ == 'Entry': q = Category.query().order(Category.name) categories = q.fetch(10) try: tags = reduce(lambda x,y: x + ' ' + y, entity.tags) except:
def Configure(template_dirs, module_cache_dir='/tmp/'): globals()['LOOKUP'] = render_mako(directories=template_dirs, module_directory=module_cache_dir, output_encoding='utf-8', filesystem_checks=True)
def get_admin_render(): return render_mako( templates_admin_root, input_encoding='utf-8', output_encoding='utf-8', )
from web.contrib.template import render_mako from pagination import * class AppURLopener(urllib.FancyURLopener): version = "QOS /0.1" urllib._urlopener = AppURLopener() #render = web.template.render('/var/www/qos') #render = web.template.render('templates') render = render_mako( directories=[ os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'), ], input_encoding='utf-8', output_encoding='utf-8', ) logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', filename='/var/log/jennifer/jennifer.log', datefmt='%Y-%m-%d %I:%M:%S', level=logging.DEBUG) #DB confs db_host = 'localhost' db_name = 'jennifer' db_user = '******' db_passwd = 'postgres'
def GET(self): web.header("Content-Type", "text/html; charset=utf-8") render = render_mako(directories=['static']) return render.provjstestpage()
#coding: utf-8 from web.contrib.template import render_mako from settings import PROJECT_PATH render = render_mako( directories=[PROJECT_PATH + '/templates'], input_encoding='utf-8', output_encoding='utf-8', module_directory='/tmp/nowater/mako_modules', encoding_errors='replace', format_exceptions=True, default_filters=['decode.utf_8'], )
def GET(self): web.header("Content-Type","text/html; charset=utf-8") render = render_mako(directories=['static']) return render.provjstestpage()
class testpage: def GET(self): web.header("Content-Type","text/html; charset=utf-8") render = render_mako(directories=['static']) return render.provjstestpage() class provjs: def GET(self): web.header('Content-Type', 'application/json') examplegraph = createPROV() rpslist = [] rpslist.append(examplegraph.to_provJSON()) return json.dumps(rpslist) urls = ( '/testpage', 'testpage', '/provjs', 'provjs', ) app = web.application(urls, globals()) render = render_mako( directories=['static'], input_encoding='utf-8', output_encoding='utf-8', ) if __name__ == "__main__": app.run()
#!/usr/bin/env python # coding: utf-8 import web # import the Mako template engine from web.contrib.template import render_mako from aplus import session import cgi, os db = web.database(dbn='mysql', db='aplus', user='******', pw='root') # 添加session全局变量,方便在模板中访问. #render = web.template.render('templates/', cache=False)#globals={'context': session}, # use Mako template engine render = render_mako( directories = [os.getcwd() + '/templates'], input_encoding = 'utf-8', output_encoding = 'utf-8', ) render_admin = render_mako ( directories = [os.getcwd() + '/templates/admin'], input_encoding = 'utf-8', output_encoding = 'utf-8', ) web.config.debug = True config = web.storage( email='*****@*****.**', site_name = 'A佳教育', site_desc = '',
consumer_key = 'fj5732PSXLwStsBbs8XCyBndd' consumer_secret = 'GRJKgyrDdSKi5OAj7ceke1m4xHS83GX6Wk2rHaac4zJVwFEIvo' access_token = '14339674-qEeB1yzpA3QSWY16ApdVsxLP2ghooyLyHZK6vCbNk' access_token_secret = 'PussjjvA6vv0DPDeN5WpVhnVFn2tJr3SDpfQKQE39aasL' auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tweepy.API(auth) web.config.debug = False urls = ('/', 'index', '/data', 'data') #Plantillas plantillas = render_mako( directories=['templates'], input_encoding='utf-8', output_encoding='utf-8', ) app = web.application(urls, locals()) class index: def GET(self): return plantillas.index() class data: def GET(self): geo = web.input().geo tweets = tweepy.Cursor(api.search, geocode=geo).items(10) resp = {}
def __init__(self, *a, **kwargs): from mako.lookup import TemplateLookup self._lookup = TemplateLookup(*a, **kwargs) def __getattr__(self, name): # Assuming all templates are html path = name + ".html" t = self._lookup.get_template(path) def wrapped(*args, **kwargs): try: return t.render(*args, **kwargs) except: return exceptions.html_error_template().render() return wrapped if web.config.debug == True: render = debug_render_mako( directories=[template_directory], input_encoding='utf-8', output_encoding='utf-8') else: render = render_mako( directories=[template_directory], input_encoding='utf-8', output_encoding='utf-8')
import web from web.contrib.template import render_mako from models import Category, Entry from google.appengine.ext import ndb from datetime import datetime, timedelta from lib.markdown2 import markdown urls = ('^/?$', 'index', '/([\w\d-]+)/?', 'entry', '/(\d{4})/(\d{1,2})/(\d{1,2})/([-\w\d]+)/?', 'fetchByDate', '/category/([\w\d]+)/?', 'category') render = render_mako(directories=['templates/shared', 'templates/blog'], input_encoding='utf-8', output_encoding='utf-8', strict_undefined=True) app = web.application(urls, globals()) app = app.gaerun() def authorise(func): def decorate(*args, **kwargs): if not users.is_current_user_admin(): raise web.forbidden() else: return func(*args, **kwargs) return decorate def extend_entry(entries, category=False):
#!/usr/bin/env python # -*- coding: utf-8 -*- import web.contrib.template as template render = template.render_mako(directories=['py/templates'], input_encoding='utf-8', output_encoding='utf-8')
#coding:utf8 import os import web from web.contrib.template import render_mako BASE_PATH=os.path.join(os.path.dirname(__file__),'../templates').replace('\\','/') render = render_mako( directories=[BASE_PATH,], input_encoding='utf-8', output_encoding='utf-8', ) render_products=render_mako( directories=[os.path.join(BASE_PATH,'products').replace('\\','/'),], input_encoding='utf-8', output_encoding='utf-8', ) render_users=render_mako( directories=[os.path.join(BASE_PATH,'users').replace('\\','/'),], input_encoding='utf-8', output_encoding='utf-8', ) render_groups=render_mako( directories=[os.path.join(BASE_PATH,'groups').replace('\\','/'),], input_encoding='utf-8', output_encoding='utf-8', )
'browser_launcher', '/audio', 'audio', '/about', 'about', '/pubsub', 'pubsub', '/pubsub/scan', 'pubsub_scan', '/static/(.*)', 'static', ) render = render_mako( directories=['templates'], input_encoding='utf8', output_encoding='utf8', ) def jsonize(func): def _(*a, **kw): ret = func(*a, **kw) web.header('Content-Type', 'application/json') return json.dumps(ret) return _ class init: @jsonize
return wrapped class debug_render_mako: def __init__(self, *a, **kwargs): from mako.lookup import TemplateLookup self._lookup = TemplateLookup(*a, **kwargs) def __getattr__(self, name): # Assuming all templates are html path = name + ".html" t = self._lookup.get_template(path) def wrapped(*args, **kwargs): try: return t.render(*args, **kwargs) except: return exceptions.html_error_template().render() return wrapped if web.config.debug == True: render = debug_render_mako(directories=[template_directory], input_encoding='utf-8', output_encoding='utf-8') else: render = render_mako(directories=[template_directory], input_encoding='utf-8', output_encoding='utf-8')
from datetime import timedelta from urllib import urlencode from urllib import urlopen from web.contrib.template import render_mako from pagination import * class AppURLopener(urllib.FancyURLopener): version = "QOS /0.1" urllib._urlopener = AppURLopener() #render = web.template.render('/var/www/qos') #render = web.template.render('templates') render = render_mako( directories=[os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),], input_encoding='utf-8', output_encoding='utf-8', ) logging.basicConfig( format='%(asctime)s:%(levelname)s:%(message)s', filename='/var/log/jennifer/jennifer.log', datefmt='%Y-%m-%d %I:%M:%S', level=logging.DEBUG) #DB confs db_host = 'localhost' db_name = 'jennifer' db_user = '******' db_passwd = 'postgres' urls = ( "/qos", "HandleReceivedQosMessage",
#db = client.get_default_database() db = conn.usuarios db #Instance the Mongo's collection where i'll introduce the data coll = db.datos coll #user = db['usuariosGiveMeMoney'] #gastos = db['gastos'] #beneficios = db['beneficios'] #Templates structure #Mako templates render = render_mako( directories = ['templates'], #Directory where we save the html files input_encoding = 'utf-8', #Codification we will use. Input output_encoding = 'utf-8') #Codification we will use. Output ###### FORMS ###### #Login for user register. login_form = form.Form( form.Textbox ('usuario', form.notnull, description='Usuario: '), #Textbox object to write the user nickname form.Password ('contrasenia', form.notnull, description='Contrasenia: '), #Password object to occult the user pass form.Button ('Ingresar'), #Button object to click and send the data ) #Intro gastos form gastos_form = form.Form( #form.Dropdown("gastos",['Alimentación', 'Gastos del hogar', 'Escolares', 'Transportes', 'Ocio', 'Otros'], description="Tipos de gasto"), #tipo_gasto = ['Alimentación', 'Gastos del hogar', 'Escolares', 'Transportes', 'Ocio', 'Otros'], form.Textbox ('alimentacion', form.notnull, description = 'Gastos en alimentacion'),
def session_hook(): web.ctx.session = session web.ctx.render = render_mako(directories=[ 'templates'], input_encoding='utf-8', output_encoding='utf-8')
import web import json from instantiation import * from web.contrib.template import render_mako urls = ('/', 'SomePage', '/query/', 'Query') app = web.application(urls, globals()) render = render_mako( directories=['.'], input_encoding='utf-8', output_encoding='utf-8', ) class SomePage: def GET(self): print "running index()" return render.index() class Query: def GET(self): result_graph = PROVContainer() result_graph.set_default_namespace("http://www.mytype.com/#") element_graph = PROVContainer() element_graph.set_default_namespace("http://www.mytype.com/#") relation_graph = PROVContainer() relation_graph.set_default_namespace("http://www.mytype.com/#") hasElement = False
#-*-coding:utf-8 -*- import web import os from web.contrib.template import render_mako db = web.database(host="127.0.0.1",dbn="mysql",db='kiidb',user="******",pw="123456") prefix = 'ii_' render_app= render_mako( directories=["templates/app"], input_encoding='utf-8', output_encoding='utf-8' ) render_cms= render_mako( directories=["templates/cms"], input_encoding='utf-8', output_encoding='utf-8' ) render_ber= render_mako( directories=["templates/menmber"], #input_encoding='utf-8', output_encoding='utf-8' ) render_status = render_mako( directories=["templates/sus"], #input_encoding='utf-8', output_encoding='utf-8'
def notfound(): return web.notfound('404') def internalerror(): return web.internalerror('404') app.notfound = notfound app.internalerror = internalerror render = render_mako( directories=[abspath + '/templates'], input_encoding='utf-8', output_encoding='utf-8', ) def codesafe(n): if re.search("select", n) or re.search(" ", n) or re.search("where", n) or re.search("=", n) or re.search("'", n): return False else: return True class index: def GET(self):
# coding: utf-8 import web from web.contrib.template import render_mako import os #import os, memcache #db = web.database(dbn = 'mysql', db='pb', user='******', pw='root') # memcache #mc = memcache.Client(['127.0.0.1:11211'], debug=0) # blog content abbrevation length 29/10/12 22:39:37 contentLength = 100 entryPerPage = 5 recentPostNum = 10 render = render_mako( directories=[os.getcwd() + '/templates/mako'], input_encoding='utf-8', output_encoding='utf-8', # import custom filters. imports=['from libs.filter import content'], ) render_admin = render_mako( directories=[os.getcwd() + '/templates/mako/admin'], input_encoding='utf-8', output_encoding='utf-8', )
from bed_utils import BlastLine fastas = { 'rice_v6': Fasta(path + '/data/rice_v6_sorghum_v1.4/rice_v6.fasta'), 'sorghum_v1.4': Fasta(path + '/data/rice_v6_sorghum_v1.4/sorghum_v1.4.fasta'), 'brachy_v1': Fasta(path + '/data/brachy_v1_sorghum_v1.4/brachy_v1.fasta'), } BL2SEQ = "/usr/bin/bl2seq -p blastn -D 1 -E 2 -q -2 -r 1 -G 5 -W 7 -F %(mask)s" \ " -Y 812045000 -d 26195 -e 2.11 -i %(iseq_file)s -j %(jseq_file)s " \ "| grep -v '#' | grep -v 'WARNING' | grep -v 'ERROR' " render = render_mako(directories=[op.join(op.dirname(__file__), 'templates')]) class Loc(object): __slots__ = ('org', 'start', 'end', 'seqid', 'rc') def __init__(self, org, seqid, start, end): self.org = org self.start = int(start) self.end = int(end) self.seqid = seqid self.rc = start > end @classmethod def from_input(self, winput): for loc in winput(locs=[]).locs: r = loc.split("..") start, end = map(int, r[2:4])
# ------------------------------------------------------------------------ # File Name: config.py # Author: Zhao Yanbai # Fri Oct 31 05:43:54 2014 # Description: none # ------------------------------------------------------------------------ import web from web.contrib.template import render_mako ACE_GLOBAL_CONF_PATH = '/etc/AceGlobal.conf' ACE_GLOBAL_LOG_PATH = '/var/log/AceGlobal.log' DBHost = '127.0.0.1' DBName = 'monitor' DBUser = '******' DBPass = '******' DBCharset = 'utf8' db = web.database( dbn = 'mysql', host = DBHost, db = DBName, user = DBUser, pw = DBPass, charset = DBCharset) render = render_mako(directories=['mako/'], input_encoding='utf-8', output_encoding='utf-8')
# -*- coding: utf-8 -*- """Mako template options which are used, basically, by all handler modules in controllers of the app. """ from web.contrib.template import render_mako from settings import (absolute, DEBUG) # Mako Template options render = render_mako( directories=[absolute('app/views')], module_directory=absolute('tmp/mako_modules'), cache_dir=absolute('tmp/mako_cache'), input_encoding='utf-8', output_encoding='utf-8', default_filters=['decode.utf8'], encoding_errors='replace', filesystem_checks=DEBUG, collection_size=512 )
db=anydbm.open('./timeStamp.txt','c') for i in range (len(twitConGeo)): db[str(i)] = str(twit[i]) + '|' + str(twitConGeo[i][0]) + '|' + str(twitConGeo[i][1]) for i in range (len(twitConGeo)): datos = db[str(i)].split('|') print(datos) db.close() render = render_mako( directories=['plantillas'], input_encoding='utf-8', output_encoding='utf-8', ) rss=feedparser.parse('http://feeds.feedburner.com/cyberhades/rss') categorias=["Categoria-I","Categoria-II"] categoriasVIP=["Categoria-I","Categoria-II","Categoria-III","Categoria-IV"] """ lista_post=[] lista_post_personal=[]
from web.contrib.template import render_mako from models import Category, Entry from google.appengine.ext import ndb from datetime import datetime, timedelta from lib.markdown2 import markdown urls = ( '^/?$', 'index', '/([\w\d-]+)/?', 'entry', '/(\d{4})/(\d{1,2})/(\d{1,2})/([-\w\d]+)/?', 'fetchByDate', '/category/([\w\d]+)/?', 'category' ) render = render_mako( directories=['templates/shared', 'templates/blog'], input_encoding='utf-8', output_encoding='utf-8', strict_undefined=True ) app = web.application(urls, globals()) app = app.gaerun() def authorise(func): def decorate(*args, **kwargs): if not users.is_current_user_admin(): raise web.forbidden() else: return func(*args, **kwargs) return decorate def extend_entry(entries, category=False):
# -*- coding: utf-8 -*- """Mako template options which are used, basically, by all handler modules in controllers of the app. """ from web.contrib.template import render_mako from settings import (absolute, DEBUG) # Mako Template options render = render_mako(directories=[absolute('app/views')], module_directory=absolute('tmp/mako_modules'), cache_dir=absolute('tmp/mako_cache'), input_encoding='utf-8', output_encoding='utf-8', default_filters=['decode.utf8'], encoding_errors='replace', filesystem_checks=DEBUG, collection_size=512)
#!/usr/bin/env python # -*- coding:utf-8 -*- import web from web.contrib.template import render_mako from config.database import * from config.urls import * # import os # Debug : True or False web.config.debug = True # render = web.template.render("templates/") render = render_mako( directories=["html"], # directories=[os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),], input_encoding="utf-8", output_encoding="utf-8", default_filters=["decode.utf_8"], ) db = web.database(dbn=dbType, db=dbName, host=dbHost, port=dbPort, user=dbUser, pw=dbPass, charset=dbChar)
except pymongo.errors.ConnectionFailure, e: print "No se pudo conectar a MongoDB: %s" % e conn db = conn.usuarios db col = db.datos col print conn.database_names() print db.collection_names() # Uso de plantillas mako plantillas = render_mako(directories=["templates"], input_encoding="utf-8", output_encoding="utf-8") # Expresiones regulares para los formularios validatorEmail = form.regexp(r"\b[a-zA-Z\d._-]+@[a-zA-Z.-]+\.[a-zA-Z]{2,4}\b", "* Correo electrónico no válido.") validatorVISA = form.regexp( r"([\d]{4}) ([\d]{4}) ([\d]{4}) ([\d]{4})|([\d]{4})-([\d]{4})-([\d]{4})-([\d]{4})", "* Número tarjeta VISA no válido.", ) login = form.Form( form.Textbox("nombre", required=True, description="Nombre del usuario:"), form.Textbox("apellidos", required=True, description="Apellidos:"), form.Textbox("DNI", required=True), form.Textbox("correo_electronico", validatorEmail, required=True, description="Correo electronico:"), form.Dropdown( "Dia_de_nacimiento",
#!/usr/bin/env python #-*- coding:utf-8 -*- import web from web.contrib.template import render_mako from config.database import * from config.urls import * #import os # Debug : True or False web.config.debug = True #render = web.template.render("templates/") render = render_mako( directories=['html'], #directories=[os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),], input_encoding='utf-8', output_encoding='utf-8', default_filters=['decode.utf_8'], ) db = web.database(dbn=dbType, db=dbName, host=dbHost, port=dbPort, user=dbUser, pw=dbPass, charset=dbChar)
from GetWeather import * from GetLocations import * sys.path.append(os.path.join(os.path.dirname( __file__ ),'lib')) from PlainWeatherUtils import PlainWeatherUtils urls = ( '/', 'PlainWeather', '/getweather', 'GetWeather', '/getlocations', 'GetLocations' ) render = render_mako( directories=['templates'], input_encoding='utf-8', output_encoding='utf-8', ) app = web.application(urls, globals()) curdir = os.path.dirname(__file__) session = web.session.Session(app, web.session.DiskStore(os.path.join(curdir,'sessions')),) application = app.wsgifunc() class PlainWeather: def __init__(self): base_dir = os.path.dirname(os.path.realpath(__file__)) os.chdir(base_dir) return
'/rss', 'RSS', '/charts', 'charts', '/charts_ajax','charts_ajax', '/maps','maps', '/(.*)', 'error' ) # Para poder usar sesiones con web.py web.config.debug = False app = web.application(urls, globals()) #Plantillas Mako plantillas = render_mako( directories=['templates/'], input_encoding='utf-8', output_encoding='utf-8' ) #Inicializamos la variable session a cadena vacía porque inicialmente no hay ningún usuario que haya iniciado sesion sesion = web.session.Session(app, web.session.DiskStore('sessions'), initializer={'usuario':''}) #Conexion local ip = '127.0.0.1' conexion = pymongo.Connection(ip) # Creando/obteniendo un objeto que referencie a la base de datos. db = conexion['bdregistro'] #base de datos a usar