Move version constants to version.py, add version to serialized flows.

For now, we don't do anything with the serialized version info, but this should
give us some future-proofing for serialization format changes.
This commit is contained in:
Aldo Cortesi 2011-03-09 12:35:38 +13:00
parent 897c4bfc52
commit 592812467d
5 changed files with 6 additions and 6 deletions

View File

@ -1 +0,0 @@
VERSION = "0.3"

View File

@ -4,7 +4,7 @@
""" """
import subprocess, base64, sys, json, hashlib, Cookie, cookielib, copy import subprocess, base64, sys, json, hashlib, Cookie, cookielib, copy
import proxy, threading, netstring, filt import proxy, threading, netstring, filt
import controller import controller, version
class RunException(Exception): class RunException(Exception):
def __init__(self, msg, returncode, errout): def __init__(self, msg, returncode, errout):
@ -230,6 +230,7 @@ class Flow:
request = self.request.get_state() if self.request else None, request = self.request.get_state() if self.request else None,
response = self.response.get_state() if self.response else None, response = self.response.get_state() if self.response else None,
error = self.error.get_state() if self.error else None, error = self.error.get_state() if self.error else None,
version = version.IVERSION
) )
if nobackup: if nobackup:
d["backup"] = None d["backup"] = None

2
libmproxy/version.py Normal file
View File

@ -0,0 +1,2 @@
IVERSION = (0, 3)
VERSION = ".".join([str(i) for i in IVERSION])

View File

@ -17,9 +17,7 @@
import sys, os.path import sys, os.path
from libmproxy import proxy, dump, utils from libmproxy import proxy, dump, utils
from libmproxy import VERSION from libmproxy.version import VERSION
from optparse import OptionParser, OptionGroup from optparse import OptionParser, OptionGroup

View File

@ -17,7 +17,7 @@
import sys, os.path import sys, os.path
from libmproxy import proxy, controller, console, utils from libmproxy import proxy, controller, console, utils
from libmproxy import VERSION from libmproxy.version import VERSION
from optparse import OptionParser, OptionGroup from optparse import OptionParser, OptionGroup