[merge] fix-shebang from 5.0 to trunk
authorXavier Morel <xmo@tinyerp.com>
Wed, 2 Dec 2009 10:14:58 +0000 (11:14 +0100)
committerXavier Morel <xmo@tinyerp.com>
Wed, 2 Dec 2009 10:14:58 +0000 (11:14 +0100)
bzr revid: hmo@tinyerp.com-20091202091102-r509b0bgogyul6yx
bzr revid: xmo@tinyerp.com-20091202101458-6a1mo240grkld6do

1  2 
bin/addons/__init__.py
bin/addons/module_graph.py
bin/openerp-server.py
bin/osv/fields.py
bin/report/interface.py
bin/report/render/rml2html/rml2html.py
bin/service/web_services.py
bin/sql_db.py
bin/tools/graph.py
doc/tests/check_profile_l10n_all.py

Simple merge
@@@ -1,13 -1,15 +1,14 @@@
+ #!/usr/bin/env python
 -# -*- encoding: utf-8 -*-
 +# -*- coding: utf-8 -*-
  ##############################################################################
 -#
 -#    OpenERP, Open Source Management Solution 
 -#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 -#    $Id$
 +#    
 +#    OpenERP, Open Source Management Solution
 +#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
  #
  #    This program is free software: you can redistribute it and/or modify
 -#    it under the terms of the GNU General Public License as published by
 -#    the Free Software Foundation, either version 3 of the License, or
 -#    (at your option) any later version.
 +#    it under the terms of the GNU Affero General Public License as
 +#    published by the Free Software Foundation, either version 3 of the
 +#    License, or (at your option) any later version.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -1,14 -1,15 +1,14 @@@
- #!/usr/bin/python
+ #!/usr/bin/env python
 -# -*- encoding: utf-8 -*-
 +# -*- coding: utf-8 -*-
  ##############################################################################
 -#
 -#    OpenERP, Open Source Management Solution 
 -#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 -#    $Id$
 +#    
 +#    OpenERP, Open Source Management Solution
 +#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
  #
  #    This program is free software: you can redistribute it and/or modify
 -#    it under the terms of the GNU General Public License as published by
 -#    the Free Software Foundation, either version 3 of the License, or
 -#    (at your option) any later version.
 +#    it under the terms of the GNU Affero General Public License as
 +#    published by the Free Software Foundation, either version 3 of the
 +#    License, or (at your option) any later version.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
Simple merge
Simple merge
@@@ -454,7 -455,7 +454,7 @@@ if __name__=="__main__"
              rml2html_help()
          print parseString(file(sys.argv[1], 'r').read()),
      else:
 -        print 'Usage: trml2pdf input.rml >output.pdf'
 -        print 'Try \'trml2pdf --help\' for more information.'
 +        print 'Usage: rml2html input.rml >output.html'
 +        print 'Try \'rml2html --help\' for more information.'
  
- # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@@ -286,14 -285,11 +286,11 @@@ class db(netsvc.ExportService)
              cr.close()
          return True
  
 -    def db_exist(self, db_name):
 +    def exp_db_exist(self, db_name):
-         try:
-             db = sql_db.db_connect(db_name)
-             return True
-         except:
-             return False
+         ## Not True: in fact, check if connection to database is possible. The database may exists
+         return bool(sql_db.db_connect(db_name))
  
 -    def list(self):
 +    def exp_list(self):
          db = sql_db.db_connect('template1')
          cr = db.cursor()
          try:
diff --cc bin/sql_db.py
@@@ -152,24 -147,24 +152,25 @@@ class Cursor(object)
          return res
  
      def print_log(self):
 +        global sql_counter
 +        sql_counter += self.sql_log_count
          if not self.sql_log:
              return
 -
          def process(type):
              sqllogs = {'from':self.sql_from_log, 'into':self.sql_into_log}
 -            if not sqllogs[type]:
 -                return
 -            sqllogitems = sqllogs[type].items()
 -            sqllogitems.sort(key=lambda k: k[1][1])
              sum = 0
 -            log("SQL LOG %s:" % (type,))
 -            for r in sqllogitems:
 -                delay = timedelta(microseconds=r[1][1])
 -                log("table: %s: %s/%s" %(r[0], str(delay), r[1][0]))
 -                sum+= r[1][1]
 +            if sqllogs[type]:
 +                sqllogitems = sqllogs[type].items()
 +                sqllogitems.sort(key=lambda k: k[1][1])
 +                log("SQL LOG %s:" % (type,))
 +                for r in sqllogitems:
 +                    delay = timedelta(microseconds=r[1][1])
 +                    log("table: %s: %s/%s" %(r[0], str(delay), r[1][0]))
 +                    sum+= r[1][1]
 +                sqllogs[type].clear()
              sum = timedelta(microseconds=sum)
 -            log("SUM:%s/%d" % (str(sum), self.sql_log_count))
 +            log("SUM %s:%s/%d [%d]" % (type, str(sum), self.sql_log_count, sql_counter))
+             sqllogs[type].clear()
          process('from')
          process('into')
          self.sql_log_count = 0
@@@ -1,14 -1,15 +1,14 @@@
- #!/usr/bin/python
+ #!/usr/bin/env python
 -# -*- encoding: utf-8 -*-
 +# -*- coding: utf-8 -*-
  ##############################################################################
 -#
 -#    OpenERP, Open Source Management Solution 
 -#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 -#    $Id$
 +#    
 +#    OpenERP, Open Source Management Solution
 +#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
  #
  #    This program is free software: you can redistribute it and/or modify
 -#    it under the terms of the GNU General Public License as published by
 -#    the Free Software Foundation, either version 3 of the License, or
 -#    (at your option) any later version.
 +#    it under the terms of the GNU Affero General Public License as
 +#    published by the Free Software Foundation, either version 3 of the
 +#    License, or (at your option) any later version.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@@ -1,14 -1,15 +1,14 @@@
- #!/usr/bin/python
+ #!/usr/bin/env python
 -# -*- encoding: utf-8 -*-
 +# -*- coding: utf-8 -*-
  ##############################################################################
 -#
 -#    OpenERP, Open Source Management Solution 
 -#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 -#    $Id$
 +#    
 +#    OpenERP, Open Source Management Solution
 +#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
  #
  #    This program is free software: you can redistribute it and/or modify
 -#    it under the terms of the GNU General Public License as published by
 -#    the Free Software Foundation, either version 3 of the License, or
 -#    (at your option) any later version.
 +#    it under the terms of the GNU Affero General Public License as
 +#    published by the Free Software Foundation, either version 3 of the
 +#    License, or (at your option) any later version.
  #
  #    This program is distributed in the hope that it will be useful,
  #    but WITHOUT ANY WARRANTY; without even the implied warranty of