Commit 3fcd0200 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Deprecate ERP5Site.log. Use Products.ERP5Type.Log.log instead.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12949 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 52758c86
...@@ -29,12 +29,14 @@ from Products.ERP5Type import allowClassTool ...@@ -29,12 +29,14 @@ from Products.ERP5Type import allowClassTool
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.ERP5Type import ERP5TypeInformation from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5.Document.BusinessTemplate import BusinessTemplate from Products.ERP5.Document.BusinessTemplate import BusinessTemplate
from Products.ERP5Type.Log import log as unrestrictedLog
import ERP5Defaults import ERP5Defaults
from zLOG import LOG, INFO from zLOG import LOG, INFO
from string import join from string import join
import os, traceback import os, traceback
import warnings
MARKER = [] MARKER = []
...@@ -924,21 +926,12 @@ class ERP5Site(FolderMixIn, CMFSite): ...@@ -924,21 +926,12 @@ class ERP5Site(FolderMixIn, CMFSite):
new_instance.immediateReindexObject() new_instance.immediateReindexObject()
return new_instance return new_instance
def log(self,description,content=''): def log(self, description, content='', level=INFO):
""" """Put a log message """
Put a log message warnings.warn("The usage of ERP5Site.log is deprecated.\n"
""" "Please use Products.ERP5Type.Log.log instead.",
if content=='': # allow for content only while keeping interface DeprecationWarning)
description,content=content,description unrestrictedLog(description, content = content, level = level)
st=traceback.extract_stack()
head=[]
for frame in st[-2:-6:-1]: # assume no deep nesting in Script (Python)
if frame[0]=='Script (Python)': # does anybody log from ZPT or dtml?
head.append('%s, %d' % (frame[2],frame[1]))
head=' -> '.join(head)
description='%s: %s' % (head,description)
LOG(description, 0, content)
Globals.InitializeClass(ERP5Site) Globals.InitializeClass(ERP5Site)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment