本文整理汇总了Python中webnotes.getTraceback函数的典型用法代码示例。如果您正苦于以下问题:Python getTraceback函数的具体用法?Python getTraceback怎么用?Python getTraceback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTraceback函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: execute
def execute(self, db_name, event, now):
"""
Executes event in the specifed db
"""
import webnotes, webnotes.defs, webnotes.db
try:
webnotes.conn = webnotes.db.Database(user=db_name, password=webnotes.get_db_password(db_name))
webnotes.session = {'user':'Administrator'}
module = '.'.join(event.split('.')[:-1])
method = event.split('.')[-1]
exec 'from %s import %s' % (module, method)
webnotes.conn.begin()
ret = locals()[method]()
webnotes.conn.commit()
webnotes.conn.close()
self.log(db_name, event, ret or 'Ok')
except Exception, e:
if now:
print webnotes.getTraceback()
else:
self.log(db_name, event, webnotes.getTraceback())
开发者ID:antoxin,项目名称:wnframework,代码行数:26,代码来源:scheduler.py
示例2: respond
def respond():
import webnotes
import webnotes.webutils
import MySQLdb
try:
return webnotes.webutils.render(webnotes.form_dict.get('page'))
except webnotes.SessionStopped:
print "Content-type: text/html"
print
print session_stopped % {
"app_name": webnotes.get_config().app_name,
"trace": webnotes.getTraceback(),
"title": "Upgrading..."
}
except MySQLdb.ProgrammingError, e:
if e.args[0]==1146:
print "Content-type: text/html"
print
print session_stopped % {
"app_name": webnotes.get_config().app_name,
"trace": webnotes.getTraceback(),
"title": "Installing..."
}
else:
raise e
开发者ID:rohitw1991,项目名称:innoworth-lib,代码行数:26,代码来源:web.py
示例3: write_log
def write_log():
import os
import webnotes.defs
import webnotes
patch_log = open(os.path.join(webnotes.defs.modules_path, 'patches', 'patch.log'), 'a')
patch_log.write(('\n\nError in %s:\n' % webnotes.conn.cur_db_name) + webnotes.getTraceback())
patch_log.close()
if getattr(webnotes.defs,'admin_email_notification',0):
from webnotes.utils import sendmail
subj = 'Error in running patches in %s' % webnotes.conn.cur_db_name
msg = subj + '<br><br>Login User: ' + webnotes.user.name + '<br><br>' + webnotes.getTraceback()
sendmail(['[email protected]'], sender='[email protected]', subject= subj, parts=[['text/plain', msg]])
开发者ID:Vichagserp,项目名称:cimworks,代码行数:14,代码来源:patch.py
示例4: write_log
def write_log():
import os
import webnotes.defs
import webnotes
patch_log = open(os.path.join(webnotes.defs.modules_path, 'patches', 'patch.log'), 'a')
patch_log.write(('\n\nError in %s:\n' % webnotes.conn.cur_db_name) + webnotes.getTraceback())
patch_log.close()
if getattr(webnotes.defs,'admin_email_notification',0):
from webnotes.utils import sendmail
subj = 'Patch Error. <br>Account: %s' % webnotes.conn.cur_db_name
msg = subj + '<br><br>' + webnotes.getTraceback()
print msg
开发者ID:antoxin,项目名称:wnframework,代码行数:14,代码来源:patch_handler.py
示例5: execute_patch
def execute_patch(patchmodule, method=None, methodargs=None):
"""execute the patch"""
block_user(True)
webnotes.conn.begin()
log("Executing %s in %s" % (patchmodule or str(methodargs), webnotes.conn.cur_db_name))
try:
if patchmodule:
patch = __import__(patchmodule, fromlist=True)
getattr(patch, "execute")()
update_patch_log(patchmodule)
log("Success")
elif method:
method(**methodargs)
webnotes.conn.commit()
except Exception, e:
webnotes.conn.rollback()
global has_errors
has_errors = True
tb = webnotes.getTraceback()
log(tb)
import os
if os.environ.get("HTTP_HOST"):
add_to_patch_log(tb)
开发者ID:beliezer,项目名称:wnframework,代码行数:25,代码来源:patch_handler.py
示例6: get_comments
def get_comments(page_name):
if page_name == '404':
comments = """error: %s""" % webnotes.getTraceback()
else:
comments = """page: %s""" % page_name
return comments
开发者ID:AminfiBerlin,项目名称:erpnext,代码行数:7,代码来源:utils.py
示例7: render_page
def render_page(page_name):
"""get page html"""
page_name = scrub_page_name(page_name)
html = ''
if not (hasattr(conf, 'auto_cache_clear') and conf.auto_cache_clear or 0):
html = webnotes.cache().get_value("page:" + page_name)
from_cache = True
if not html:
from webnotes.auth import HTTPRequest
webnotes.http_request = HTTPRequest()
html = build_page(page_name)
from_cache = False
if not html:
raise PageNotFoundError
if page_name=="error":
html = html.replace("%(error)s", webnotes.getTraceback())
else:
comments = "\n\npage:"+page_name+\
"\nload status: " + (from_cache and "cache" or "fresh")
html += """\n<!-- %s -->""" % webnotes.utils.cstr(comments)
return html
开发者ID:Yellowen,项目名称:wnframework,代码行数:27,代码来源:webutils.py
示例8: manage_recurring_invoices
def manage_recurring_invoices():
"""
Create recurring invoices on specific date by copying the original one
and notify the concerned people
"""
recurring_invoices = webnotes.conn.sql("""select name, recurring_id
from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0)=1
and docstatus=1 and next_date=%s
and next_date <= ifnull(end_date, '2199-12-31')""", nowdate())
exception_list = []
for ref_invoice, recurring_id in recurring_invoices:
if not webnotes.conn.sql("""select name from `tabSales Invoice`
where posting_date=%s and recurring_id=%s and docstatus=1""",
(nowdate(), recurring_id)):
try:
ref_wrapper = webnotes.model_wrapper('Sales Invoice', ref_invoice)
new_invoice_wrapper = make_new_invoice(ref_wrapper)
send_notification(new_invoice_wrapper)
webnotes.conn.commit()
except Exception, e:
webnotes.conn.rollback()
webnotes.conn.begin()
webnotes.conn.sql("update `tabSales Invoice` set \
convert_into_recurring_invoice = 0 where name = %s", ref_invoice)
notify_errors(ref_invoice, ref_wrapper.doc.owner)
webnotes.conn.commit()
exception_list.append(webnotes.getTraceback())
finally:
开发者ID:masums,项目名称:erpnext,代码行数:31,代码来源:sales_invoice.py
示例9: get_html
def get_html(page_name):
"""get page html"""
page_name = scrub_page_name(page_name)
html = ''
# load from cache, if auto cache clear is falsy
if not (hasattr(conf, 'auto_cache_clear') and conf.auto_cache_clear or 0):
html = webnotes.cache().get_value("page:" + page_name)
from_cache = True
if not html:
html = load_into_cache(page_name)
from_cache = False
if not html:
html = get_html("404")
if page_name=="error":
html = html.replace("%(error)s", webnotes.getTraceback())
else:
comments = "\n\npage:"+page_name+\
"\nload status: " + (from_cache and "cache" or "fresh")
html += """\n<!-- %s -->""" % webnotes.utils.cstr(comments)
return html
开发者ID:MiteshC,项目名称:erpnext,代码行数:26,代码来源:utils.py
示例10: upload
def upload():
from webnotes.utils.datautils import read_csv_content_from_uploaded_file
from webnotes.modules import scrub
rows = read_csv_content_from_uploaded_file()
if not rows:
msg = [_("Please select a csv file")]
return {"messages": msg, "error": msg}
columns = [scrub(f) for f in rows[4]]
columns[0] = "name"
columns[3] = "att_date"
ret = []
error = False
from webnotes.utils.datautils import check_record, import_doc
doctype_dl = webnotes.get_doctype("Attendance")
for i, row in enumerate(rows[5:]):
if not row:
continue
row_idx = i + 5
d = webnotes._dict(zip(columns, row))
d["doctype"] = "Attendance"
if d.name:
d["docstatus"] = webnotes.conn.get_value("Attendance", d.name, "docstatus")
try:
check_record(d, doctype_dl=doctype_dl)
ret.append(import_doc(d, "Attendance", 1, row_idx, submit=True))
except Exception, e:
error = True
ret.append("Error for row (#%d) %s : %s" % (row_idx, len(row) > 1 and row[1] or "", cstr(e)))
webnotes.errprint(webnotes.getTraceback())
开发者ID:bindscha,项目名称:erpnext-fork,代码行数:34,代码来源:upload_attendance.py
示例11: send
def send(self):
"""
* Execute get method
* Send email to recipients
"""
if not self.doc.recipient_list: return
self.sending = True
result, email_body = self.get()
recipient_list = self.doc.recipient_list.split("\n")
# before sending, check if user is disabled or not
# do not send if disabled
profile_list = webnotes.conn.sql("SELECT name, enabled FROM tabProfile", as_dict=1)
for profile in profile_list:
if profile['name'] in recipient_list and profile['enabled'] == 0:
del recipient_list[recipient_list.index(profile['name'])]
from webnotes.utils.email_lib import sendmail
try:
#webnotes.msgprint('in send')
sendmail(
recipients=recipient_list,
sender='[email protected]',
reply_to='[email protected]',
subject=self.doc.frequency + ' Digest',
msg=email_body,
from_defs=1
)
except Exception, e:
webnotes.msgprint('There was a problem in sending your email. Please contact [email protected]')
webnotes.errprint(webnotes.getTraceback())
开发者ID:antoxin,项目名称:erpnext,代码行数:33,代码来源:email_digest.py
示例12: render_page
def render_page(page_name):
"""get page html"""
set_content_type(page_name)
if page_name.endswith('.html'):
page_name = page_name[:-5]
html = ''
if not conf.auto_cache_clear:
html = webnotes.cache().get_value("page:" + page_name)
from_cache = True
if not html:
html = build_page(page_name)
from_cache = False
if not html:
raise PageNotFoundError
if page_name=="error":
html = html.replace("%(error)s", webnotes.getTraceback())
elif "text/html" in webnotes._response.headers["Content-Type"]:
comments = "\npage:"+page_name+\
"\nload status: " + (from_cache and "cache" or "fresh")
html += """\n<!-- %s -->""" % webnotes.utils.cstr(comments)
return html
开发者ID:Halfnhav,项目名称:wnframework,代码行数:27,代码来源:webutils.py
示例13: execute_patch
def execute_patch(patchmodule, method=None, methodargs=None):
"""execute the patch"""
success = False
block_user(True)
webnotes.conn.begin()
try:
log('Executing %s in %s' % (patchmodule or str(methodargs), webnotes.conn.cur_db_name))
if patchmodule:
if patchmodule.startswith("execute:"):
exec patchmodule.split("execute:")[1] in globals()
else:
webnotes.get_method(patchmodule + ".execute")()
update_patch_log(patchmodule)
elif method:
method(**methodargs)
webnotes.conn.commit()
success = True
except Exception, e:
webnotes.conn.rollback()
global has_errors
has_errors = True
tb = webnotes.getTraceback()
log(tb)
import os
if os.environ.get('HTTP_HOST'):
add_to_patch_log(tb)
开发者ID:IPenuelas,项目名称:wnframework,代码行数:27,代码来源:patch_handler.py
示例14: create_material_request
def create_material_request(material_requests):
""" Create indent on reaching reorder level """
mr_list = []
defaults = webnotes.defaults.get_defaults()
exceptions_list = []
for request_type in material_requests:
for company in material_requests[request_type]:
try:
items = material_requests[request_type][company]
if not items:
continue
mr = [{
"doctype": "Material Request",
"company": company,
"fiscal_year": defaults.fiscal_year,
"transaction_date": nowdate(),
"material_request_type": request_type
}]
for d in items:
item = webnotes.doc("Item", d.item_code)
mr.append({
"doctype": "Material Request Item",
"parenttype": "Material Request",
"parentfield": "indent_details",
"item_code": d.item_code,
"schedule_date": add_days(nowdate(),cint(item.lead_time_days)),
"uom": item.stock_uom,
"warehouse": d.warehouse,
"item_name": item.item_name,
"description": item.description,
"item_group": item.item_group,
"qty": d.reorder_qty,
"brand": item.brand,
})
mr_bean = webnotes.bean(mr)
mr_bean.insert()
mr_bean.submit()
mr_list.append(mr_bean)
except:
if webnotes.local.message_log:
exceptions_list.append([] + webnotes.local.message_log)
webnotes.local.message_log = []
else:
exceptions_list.append(webnotes.getTraceback())
if mr_list:
if getattr(webnotes.local, "reorder_email_notify", None) is None:
webnotes.local.reorder_email_notify = cint(webnotes.conn.get_value('Stock Settings', None,
'reorder_email_notify'))
if(webnotes.local.reorder_email_notify):
send_email_notification(mr_list)
if exceptions_list:
notify_errors(exceptions_list)
开发者ID:Jdfkat,项目名称:erpnext,代码行数:59,代码来源:utils.py
示例15: update_file_list
def update_file_list(doctype, singles):
if doctype in singles:
doc = webnotes.doc(doctype, doctype)
if doc.file_list:
update_for_doc(doctype, doc)
webnotes.conn.set_value(doctype, None, "file_list", None)
else:
try:
for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where
ifnull(file_list, '')!=''""" % doctype, as_dict=True):
update_for_doc(doctype, doc)
webnotes.conn.commit()
webnotes.conn.sql("""alter table `tab%s` drop column `file_list`""" % doctype)
except Exception, e:
print webnotes.getTraceback()
if (e.args and e.args[0]!=1054) or not e.args:
raise e
开发者ID:bindscha,项目名称:erpnext-fork,代码行数:17,代码来源:p05_update_file_data.py
示例16: concat
def concat(self, filelist, outfile=None):
"""
Concat css and js files into a bundle
"""
from cStringIO import StringIO
out_type = outfile and outfile.split('.')[-1] or 'js'
outtxt = ''
for f in filelist:
suffix = None
if ':' in f:
f, suffix = f.split(':')
if not os.path.exists(f) or os.path.isdir(f):
continue
self.timestamps[f] = os.path.getmtime(f)
# get datas
try:
with open(f, 'r') as infile:
# get file type
ftype = f.split('.')[-1]
data = unicode(infile.read(), 'utf-8', errors='ignore')
outtxt += ('\n/*\n *\t%s\n */' % f)
# append
if suffix=='concat' or out_type != 'js' or self.no_compress or ('.min.' in f):
outtxt += '\n' + data + '\n'
else:
jsm = JavascriptMinify()
tmpin = StringIO(data.encode('utf-8'))
tmpout = StringIO()
jsm.minify(tmpin, tmpout)
tmpmin = unicode(tmpout.getvalue() or '', 'utf-8')
tmpmin.strip('\n')
outtxt += tmpmin
except Exception, e:
print "--Error in:" + f + "--"
print webnotes.getTraceback()
开发者ID:rohitw1991,项目名称:latestadbwnf,代码行数:44,代码来源:build.py
示例17: write_log
def write_log():
import os
import webnotes.defs
import webnotes
patch_log = open(os.path.join(webnotes.defs.modules_path, 'patches', 'patch.log'), 'a')
patch_log.write(('\n\nError in %s:\n' % webnotes.conn.cur_db_name) + webnotes.getTraceback())
patch_log.close()
webnotes.msgprint("There were errors in running patches, please call the Administrator")
开发者ID:cmrajan,项目名称:wnframework,代码行数:10,代码来源:patch.py
示例18: log
def log(method):
"""log error in patch_log"""
import webnotes
webnotes.conn.rollback()
traceback = webnotes.getTraceback()
import webnotes.utils
webnotes.conn.sql("""insert into __SchedulerLog (`timestamp`, method, error)
values (%s, %s, %s)""", (webnotes.utils.now_datetime(), method, traceback))
return traceback
开发者ID:beliezer,项目名称:wnframework,代码行数:11,代码来源:scheduler.py
示例19: validate_parent
def validate_parent(parent_list, parenttype, ret, error):
if parent_list:
parent_list = list(set(parent_list))
for p in parent_list:
try:
obj = webnotes.bean(parenttype, p)
obj.run_method("validate")
obj.run_method("on_update")
except Exception, e:
error = True
ret.append('Validation Error for %s %s: %s' % (parenttype, p, cstr(e)))
webnotes.errprint(webnotes.getTraceback())
开发者ID:appost,项目名称:wnframework,代码行数:12,代码来源:data_import_tool.py
示例20: take_backups_gdrive
def take_backups_gdrive():
did_not_upload, error_log = [], []
try:
from setup.doctype.backup_manager.backup_googledrive import backup_to_gdrive
did_not_upload, error_log = backup_to_gdrive()
if did_not_upload: raise Exception
send_email(True, "Google Drive")
except Exception:
file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback())
webnotes.errprint(error_message)
send_email(False, "Google Drive", error_message)
开发者ID:BANSALJEE,项目名称:erpnext,代码行数:13,代码来源:backup_manager.py
注:本文中的webnotes.getTraceback函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论