[IMP] wip
bzr revid: nicolas.vanhoren@openerp.com-20101118134256-p0tlk3kbpw1njqu8
This commit is contained in:
parent
469f0c3f5b
commit
5b2a35641c
|
@ -25,6 +25,7 @@ import netsvc
|
||||||
from tools.misc import ustr
|
from tools.misc import ustr
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
import tools.maintenance as tm
|
import tools.maintenance as tm
|
||||||
|
import tools.ping
|
||||||
|
|
||||||
_nlogger = netsvc.Logger()
|
_nlogger = netsvc.Logger()
|
||||||
_CHAN = __name__.split()[-1]
|
_CHAN = __name__.split()[-1]
|
||||||
|
@ -93,6 +94,9 @@ class maintenance_contract(osv.osv):
|
||||||
for contract in self.browse(cr, uid, ids, context=context):
|
for contract in self.browse(cr, uid, ids, context=context):
|
||||||
res[contract.id] = ("unvalid", "valid")[contract.date_stop >= time.strftime('%Y-%m-%d')]
|
res[contract.id] = ("unvalid", "valid")[contract.date_stop >= time.strftime('%Y-%m-%d')]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def send_ping(self, cr, uid, context={}):
|
||||||
|
tools.ping.send_ping(cr, uid)
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name' : fields.char('Contract ID', size=384, required=True, readonly=True),
|
'name' : fields.char('Contract ID', size=384, required=True, readonly=True),
|
||||||
|
|
|
@ -95,7 +95,11 @@ class configmanager(object):
|
||||||
'maintenance_db': 'tiny_belgium',
|
'maintenance_db': 'tiny_belgium',
|
||||||
'maintenance_login': 'maintenance',
|
'maintenance_login': 'maintenance',
|
||||||
'maintenance_password': 'maintenance',
|
'maintenance_password': 'maintenance',
|
||||||
|
'ping_url': 'http://tiny.my.odoo.com:8069/phonehome.php',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.blacklist_for_save = set(['maintenance_server', 'maintenance_db',
|
||||||
|
'maintenance_login', 'maintenance_password', "ping_url"])
|
||||||
|
|
||||||
self.misc = {}
|
self.misc = {}
|
||||||
self.config_file = fname
|
self.config_file = fname
|
||||||
|
@ -446,6 +450,8 @@ class configmanager(object):
|
||||||
for opt in sorted(self.options.keys()):
|
for opt in sorted(self.options.keys()):
|
||||||
if opt in ('version', 'language', 'translate_out', 'translate_in', 'init', 'update'):
|
if opt in ('version', 'language', 'translate_out', 'translate_in', 'init', 'update'):
|
||||||
continue
|
continue
|
||||||
|
if opt in self.blacklist_for_save:
|
||||||
|
continue
|
||||||
if opt in ('log_level', 'assert_exit_level'):
|
if opt in ('log_level', 'assert_exit_level'):
|
||||||
p.set('options', opt, loglevelnames.get(self.options[opt], self.options[opt]))
|
p.set('options', opt, loglevelnames.get(self.options[opt], self.options[opt]))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -21,20 +21,21 @@
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
import pooler
|
import pooler
|
||||||
|
import config
|
||||||
|
|
||||||
def send_ping(cr, uid):
|
def send_ping(cr, uid):
|
||||||
pooler.get_pool(cr.dbname)
|
pool = pooler.get_pool(cr.dbname)
|
||||||
|
|
||||||
args = urllib.urlencode({
|
args = urllib.urlencode({
|
||||||
'arg0': "coucou",
|
'arg0': "coucou",
|
||||||
})
|
})
|
||||||
uo = urllib.urlopen('http://localhost/phonehome/phonehome.php', args)
|
uo = urllib.urlopen(config.config.get("ping_url"), args)
|
||||||
try:
|
try:
|
||||||
submit_result = uo.read()
|
submit_result = uo.read()
|
||||||
finally:
|
finally:
|
||||||
uo.close()
|
uo.close()
|
||||||
|
|
||||||
return ""
|
return submit_result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue