All Samples(8463) | Call(7746) | Derive(0) | Import(717)
int(x[, base]) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If base is zero, the proper base is guessed based on the string content. If the argument is outside the integer range a long object will be returned instead.
src/p/y/pyogp.apps-0.1dev/pyogp/apps/examples/parse_packets.py pyogp.apps(Download)
import traceback
from pyogp.lib.base.message.udpdeserializer import UDPMessageDeserializer
from pyogp.lib.base.settings import Settings
from logging import getLogger, StreamHandler, Formatter, CRITICAL, ERROR, WARNING, INFO, DEBUG
logger = getLogger('parse_packet')
src/l/e/LEPL-4.3.2/src/lepl/_example/trace.py LEPL(Download)
''' from logging import basicConfig, INFO, DEBUG from lepl import *
src/r/m/RMG-Py-HEAD/rmg/log.py RMG-Py(Download)
import os.path import sys from logging import critical, exception, error, warning, info, debug, log, \ CRITICAL, ERROR, WARNING, INFO, DEBUG, \ addLevelName, getLogger, StreamHandler, Formatter, FileHandler
addLevelName(CRITICAL, 'Critical: ') addLevelName(ERROR, 'Error: ') addLevelName(WARNING, 'Warning: ') addLevelName(INFO, '') addLevelName(VERBOSE, '') addLevelName(DEBUG, '')
src/s/t/StarCluster-0.91/starcluster/logger.py StarCluster(Download)
import types
import logging
import logging.handlers
from logging import INFO, DEBUG, WARN, ERROR, FATAL
from starcluster import static
INFO_NO_NEWLINE = logging.INFO + 1
class ConsoleLogger(logging.StreamHandler):
formatters = { logging.INFO: logging.Formatter(">>> %(message)s\n"),
log.addHandler(rfh) console = ConsoleLogger() console.setLevel(logging.INFO) log.addHandler(console) #import platform
src/v/i/vic-HEAD/vic-p4a-bundle/ViC/workflows/utils.py vic(Download)
from Products.ViC import config import os from logging import getLogger, INFO, WARNING from Products.ViC.utils import ProxyContext from AccessControl import ClassSecurityInfo, getSecurityManager import traceback , StringIO import sre
def getEmailTemplate(group, templateName, type="group", ext="txt"):
tName = "%s.%s"%(templateName , ext)
l = getLogger("getEmailTemplate")
l.setLevel(WARNING)
l.log(INFO, "getting %s"%tName)
l.log(INFO, str(group.keys()))
# We are moving these from bogus .email
try:
try:
template = group[".emails"][tName]
l.log(INFO, "got template from internal store")
raw = template.getText()
l.log(INFO, 'Raw\n %s'%raw)
c = sre.compile("\<(br).{1,3}\>")
msg = sre.sub(c, '\n', raw)
c = sre.compile("\<.{1,5}?\>")
t = sre.sub(c, '', msg)
l.log(INFO, 'Processed: %s'%t)
sm.removeContext(context)
else:
tpath = os.path.join(config.COPY_PATH, "emails", type , tName)
l.log(INFO, tpath)
if os.path.exists(tpath):
l.log(INFO, "had to get template from filesystem")
f = file(tpath, 'r')
#if loading html, don't strip tags
t = raw
f.close()
l.log(INFO, t)
t = "\r\n\r\n" + t
return t
try:
try:
if team:
l.log(INFO, "joining %s"%t)
mship = team.getMembershipByMemberId( user.getId() )
workflowTool = getToolByName(team, "portal_workflow")
if not mship:
src/v/i/vic-HEAD/vic-bundle/ViC/workflows/utils.py vic(Download)
from Products.ViC import config import os from logging import getLogger, INFO, WARNING from Products.ViC.utils import ProxyContext from AccessControl import ClassSecurityInfo, getSecurityManager import traceback , StringIO import sre
def getEmailTemplate(group, templateName, type="group", ext="txt"):
tName = "%s.%s"%(templateName , ext)
l = getLogger("getEmailTemplate")
l.setLevel(WARNING)
l.log(INFO, "getting %s"%tName)
l.log(INFO, str(group.keys()))
# We are moving these from bogus .email
try:
try:
template = group[".emails"][tName]
l.log(INFO, "got template from internal store")
raw = template.getText()
l.log(INFO, 'Raw\n %s'%raw)
c = sre.compile("\<(br).{1,3}\>")
msg = sre.sub(c, '\n', raw)
c = sre.compile("\<.{1,5}?\>")
t = sre.sub(c, '', msg)
l.log(INFO, 'Processed: %s'%t)
sm.removeContext(context)
else:
tpath = os.path.join(config.COPY_PATH, "emails", type , tName)
l.log(INFO, tpath)
if os.path.exists(tpath):
l.log(INFO, "had to get template from filesystem")
f = file(tpath, 'r')
#if loading html, don't strip tags
t = raw
f.close()
l.log(INFO, t)
t = "\r\n\r\n" + t
return t
try:
try:
if team:
l.log(INFO, "joining %s"%t)
mship = team.getMembershipByMemberId( user.getId() )
workflowTool = getToolByName(team, "portal_workflow")
if not mship:
src/v/i/vic-HEAD/trunk/ViC/workflows/utils.py vic(Download)
from Products.ViC import config import os from logging import getLogger, INFO, WARNING from Products.ViC.utils import ProxyContext from AccessControl import ClassSecurityInfo, getSecurityManager import traceback , StringIO import sre
def getEmailTemplate(group, templateName, type="group", ext="txt"):
tName = "%s.%s"%(templateName , ext)
l = getLogger("getEmailTemplate")
l.setLevel(WARNING)
l.log(INFO, "getting %s"%tName)
l.log(INFO, str(group.keys()))
# We are moving these from bogus .email
try:
try:
template = group[".emails"][tName]
l.log(INFO, "got template from internal store")
raw = template.getText()
l.log(INFO, 'Raw\n %s'%raw)
c = sre.compile("\<(br).{1,3}\>")
msg = sre.sub(c, '\n', raw)
c = sre.compile("\<.{1,5}?\>")
t = sre.sub(c, '', msg)
l.log(INFO, 'Processed: %s'%t)
sm.removeContext(context)
else:
tpath = os.path.join(config.COPY_PATH, "emails", type , tName)
l.log(INFO, tpath)
if os.path.exists(tpath):
l.log(INFO, "had to get template from filesystem")
f = file(tpath, 'r')
#if loading html, don't strip tags
t = raw
f.close()
l.log(INFO, t)
t = "\r\n\r\n" + t
return t
try:
try:
if team:
l.log(INFO, "joining %s"%t)
mship = team.getMembershipByMemberId( user.getId() )
workflowTool = getToolByName(team, "portal_workflow")
if not mship:
src/v/i/vic-HEAD/ViC/workflows/utils.py vic(Download)
from Products.ViC import config import os from logging import getLogger, INFO, WARNING from Products.ViC.utils import ProxyContext from AccessControl import ClassSecurityInfo, getSecurityManager import traceback , StringIO import sre
def getEmailTemplate(group, templateName, type="group", ext="txt"):
tName = "%s.%s"%(templateName , ext)
l = getLogger("getEmailTemplate")
l.setLevel(WARNING)
l.log(INFO, "getting %s"%tName)
l.log(INFO, str(group.keys()))
# We are moving these from bogus .email
try:
try:
template = group[".emails"][tName]
l.log(INFO, "got template from internal store")
raw = template.getText()
l.log(INFO, 'Raw\n %s'%raw)
c = sre.compile("\<(br).{1,3}\>")
msg = sre.sub(c, '\n', raw)
c = sre.compile("\<.{1,5}?\>")
t = sre.sub(c, '', msg)
l.log(INFO, 'Processed: %s'%t)
sm.removeContext(context)
else:
tpath = os.path.join(config.COPY_PATH, "emails", type , tName)
l.log(INFO, tpath)
if os.path.exists(tpath):
l.log(INFO, "had to get template from filesystem")
f = file(tpath, 'r')
#if loading html, don't strip tags
t = raw
f.close()
l.log(INFO, t)
t = "\r\n\r\n" + t
return t
try:
try:
if team:
l.log(INFO, "joining %s"%t)
mship = team.getMembershipByMemberId( user.getId() )
workflowTool = getToolByName(team, "portal_workflow")
if not mship:
src/v/i/vic-HEAD/pic/vic-bundle/Confirmation/content/confirmation.py vic(Download)
from Products.CMFCore.utils import getToolByName from zope.interface import implements from Products.Confirmation.utils import ProxyContext from logging import INFO, getLogger from exceptions import Exception CONFIRMATIONRELATIONSHIP="confirms"
c = getToolByName(self.context, 'portal_confirmations')
u = getToolByName(self.context, 'portal_uidgenerator')
uid = u()
l.log(INFO, "creating confirmation %s"%uid)
sm = getSecurityManager()
proxy_roles = ['Manager',]
context = ProxyContext(proxy_roles)
sm.addContext(context)
try:
l.log(INFO, "creating content")
id=uid,
title = "Confirm %s as %s"%(name, value),
)
l.log(INFO, "conf=%s"%str(conf))
confirmation = c[conf]
confirmation.setTarget(self.context)
for id in local_roles:
confirmation.manage_addLocalRoles(id, local_roles[id])
self.context.manage_addLocalRoles(id, local_roles[id])
l.log(INFO, "info set to %s and %s"%( str(confirmation.getTarget() ),
str(confirmation.getData() ) ) )
vars = {
'portal_url': p.portal_url(),
'portal_title': "Worry about this later",
'confirm_url': confirmation.absolute_url()
}
vars.update( kwargs )
l.log(INFO, str(vars) )
self.context.MailHost.send(emailContent, email,
from_email,
subject )
l.log(INFO, "email sent")
finally:
sm.removeContext(context)
return confirmation
def __init__(self, context):
self.context = context
self.l = getLogger("ConfirmableConfirmationAdapter")
self.l.log(INFO, "In confirmableconfirmationadapter")
def sendConfirmation(self, name, value, text="", **kwargs):
"""
Send an email requesting confirmation of some piece of information
'confirm_url': confirmation.absolute_url()
}
vars.update( kwargs )
self.l.log(INFO, str(vars) )
emailContent = text%vars
if "email" in kwargs:
email = kwargs["email"]
sm.addContext(context)
try:
self.l.log(INFO,"confirming")
conf = self.context
self.l.log(INFO,"2")
pc = getToolByName(conf, 'portal_confirmations')
self.l.log(INFO,"3")
wft = getToolByName(conf, 'portal_workflow')
self.l.log(INFO,"4")
ids = wft.getWorkflowsFor(conf.getTarget())
self.l.log(INFO,"5")
for wf in ids:
self.l.log(INFO,wf)
self.l.log(INFO,wf)
action = conf.getConfirmTransitionName()
if action:
self.l.log(INFO,"performing action %s on %s"%(action, str(conf.getTarget())))
wf.doActionFor(conf.getTarget(), action )
conf.getTarget().reindexObject()
pc.manage_delObjects( [conf.getId(),] )
for wf in ids:
action = conf.getUnconfirmTransitionName()
if action:
self.l.log(INFO,"performing action %s on %s"%(action, str(conf.getTarget())))
wf.doActionFor(conf.getTarget(), action )
conf.getTarget().reindexObject()
pc.manage_delObjects( [conf.getId(),] )
def getFormText(self):
l = getLogger("getFormText")
l.log(INFO, "getting form text")
return self._formText
def setConfirmButtonText(self, text):
self._confirmButtonText = text
def getConfirmButtonText(self):
l = getLogger("confirmButtonText")
l.log(INFO, "getting confirm button text")
def getUnconfirmButtonText(self):
l = getLogger("unconfirmButtonText")
l.log(INFO, "getting unconfirmbuttontext")
return self._unconfirmButtonText
def setConfirmTransitionName(self, name):
self._confirmTransitionName=name
def getConfirmTransitionName(self):
return self._unconfirmTransitionName
l = getLogger("confirmation")
l.log(INFO, "*"*40)
l.log(INFO, "initializing confirmation")
atapi.registerType(Confirmation)
InitializeClass(Confirmation)
l.log(INFO, "*"*40)src/v/i/vic-HEAD/vic-p4a-bundle/ViC/content/project.py vic(Download)
from topp.featurelets.interfaces import IFeatureletRegistry import StringIO from opencore.interfaces import IWriteWorkflowPolicySupport from logging import getLogger, INFO, WARNING from AccessControl.SpecialUsers import system, emergency_user from Products.ViC.workflows.utils import getManagers ViCProjectSchema = ProjectSchema.copy() + Schema( (
def _configureEmails(self):
l = getLogger("_configureEmail")
l.setLevel(WARNING)
l.log(INFO, "configuring email")
group = self
l.log(INFO, "creating folder")
group.invokeFactory("Folder",
".emails",
title = ".emails",
full_name="Email Templates For Invite/Request/Accept")
l.log(INFO,"looking for emails on path")
if dir.endswith("copy/emails/group"):
for file in files:
if not file.startswith("."):
l.log(INFO, file)
page_file = open(os.path.join( dir, file), 'r')
title = page_file.readline()
emails.invokeFactory('Document', file,
title=title)
page = emails._getOb(file)
l.log(INFO, "setting page text")
def installRequiredFeaturelets(self):
l = getLogger("installRequired")
l.setLevel(WARNING)
featurelets = self.getRequiredFeaturelets()
for f in featurelets:
l.log(INFO, f)
if f not in self.objectIds():
l.log(INFO, "Installing %s"%f)
registry = getUtility(IFeatureletRegistry)
flet = registry.getFeaturelet(f)
view = self.restrictedTraverse('@@featurelet_support')
if flet:
view.installFeaturelet(flet)
l.log(INFO, "Installed")
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next