Example #1
0
class SodaIdleSodaStatsPanel(BarGraphPanel):
    sodaStatsPath = "/var/soda/stockcount.psr"
    unserializer = PHPUnserialize.PHPUnserialize()

    def __init__(self, parent, ID, pos, size):
        file = open(self.sodaStatsPath, "r")
        fcntl.flock(file, fcntl.LOCK_SH)
        stats = self.unserializer.unserialize(file.read())
        fcntl.flock(file, fcntl.LOCK_UN)
        file.close()

        stats_keys = filter(lambda x: x != "r10", stats.keys())
        stats_list = [(stats[key]["sold"], stats[key]["name"])
                      for key in stats_keys]
        stats_list.sort(cmp=lambda x, y: cmp(y, x))

        min = stats_list[-1][0]
        max = stats_list[0][0]

        BarGraphPanel.__init__(self, parent, ID, pos, size, stats_list, min,
                               max)
Example #2
0
#!/usr/bin/python
import sys, pprint
from PHPUnserialize import *

# Unserialize serialized data from STDIN

pp = pprint.PrettyPrinter()
try:
	data = sys.stdin.readline()
	session = PHPUnserialize().session_decode(data)
	pp.pprint(session)	
except Exception, e:
	print e
Example #3
0
#!/usr/bin/python
import sys, pprint
from PHPUnserialize import *

# Unserialize serialized data from STDIN

pp = pprint.PrettyPrinter()
try:
    data = sys.stdin.readline()
    #print data
    out = PHPUnserialize().unserialize(data)
    pp.pprint(out)
except Exception, e:
    print e
Example #4
0
 def __init__(self):
     self.writer = PHPSerialize.PHPSerialize()
     self.reader = PHPUnserialize.PHPUnserialize()
Example #5
0
import copy
from lib.drupy.DrupyPHP import *

#
# List of tables
#
tables = ({
    'select':
    "SELECT system.info, system.name FROM system WHERE system.type = 'theme'",
    'update':
    "UPDATE system SET system.info = '%(info)s' WHERE system.name = '%(name)s'",
    'key': 'info'
}, )

inc_bootstrap.drupal_bootstrap(inc_bootstrap.DRUPAL_BOOTSTRAP_DATABASE)
u = PHPUnserialize.PHPUnserialize()
i = 0

for t in tables:
    s_res = inc_database.db_query(t['select'])
    while True:
        s_row = inc_database.db_fetch_assoc(s_res)
        if not s_row:
            break
        try:
            udata = u.unserialize(s_row[t['key']])
        except PHPUnserialize.InvalidObject:
            continue
        out = copy.deepcopy(s_row)
        for ok, ov in out.items():
            if ok == t['key']: