Browse files

added view() for debugging purposes

  • Loading branch information...
1 parent 19614ea commit 7cad8333ce543abbd1f1b306745a7902290d1ef5 @kamired22 committed Mar 19, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 web.py
View
12 web.py
@@ -12,12 +12,14 @@
import pybloom
import json
import csv
-import os.path
+import os
import multiprocessing
import httplib
import copy
import inspect
import Queue
+import tempfile
+import subprocess
import greenlet
import gevent
@@ -348,6 +350,14 @@ def hidden_fields(self):
for name, value in self.xpath('//input[@type="hidden"]/@name||//input[@type="hidden"]/@value'):
fields[name] = value
return fields
+
+ def view(self):
+ p = tempfile.mktemp() + '.html'
+ self.save(p)
+ if os.name == 'mac': subprocess.call(('open', p))
+ elif os.name == 'nt': os.startfile(p)
+ elif os.name == 'posix': subprocess.call(('xdg-open', p))
+
class ProxyManager(object):

0 comments on commit 7cad833

Please sign in to comment.