1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

5 Commits

Author SHA1 Message Date
Mike Kazantsev
04f44debaf Use runpy.run_path() or execfile() instead of import machinery for --settings-file.
Problem with import is that it:

 - Reuses already-imported module.

  For example, --settings-file=/etc/zerobin.py won't be imported,
  because sys.modules will already contain 'zerobin' entry.

 - Alters sys.path.

  Importing module from a heavily-populated directory may potentially
  cause next imports to run code from totally unexpected places.

Using execfile() doesn't set some globals like __file__ as import does,
which has to be done manually.
It also might be a bit slower for large body of code in settings file.

runpy.run_path() can only be used on python-2.7, but does not seem
to have any downsides.
2013-04-23 12:24:29 +06:00
sam
6860778f47 Prevent 0bin to crash if the locale formatting is not supported. Moved get_pastes_count into the Paste class. Added 0bin version as query parameter in the scrip and css tags URL 2012-05-22 14:39:34 +02:00
max
801227fde1 Counter added lock compatibility 2012-05-22 02:24:39 +07:00
max
26fd2d0913 counter first version 2012-05-21 22:14:01 +07:00
sam
78eedf8acb New clean layout to be pip installable 2012-05-14 17:17:49 +02:00