- Timestamp:
- 07/31/07 10:09:19 (1 year ago)
- Files:
-
- WingDBG/trunk/DebugHttpServer.py (modified) (1 diff)
- WingDBG/trunk/WingDBG.py (modified) (9 diffs)
- WingDBG/trunk/ZopeLogFile.py (modified) (2 diffs)
- WingDBG/trunk/documentation/wingdbgdocs.html (modified) (5 diffs)
- WingDBG/trunk/utils.py (modified) (2 diffs)
- WingDBG/trunk/www/advanced.pt (modified) (2 diffs)
- WingDBG/trunk/www/connection_trouble_help.pt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WingDBG/trunk/DebugHttpServer.py
r88 r358 58 58 59 59 debugger.fErr.out('New thread created; Python ident =', thread.get_ident()) 60 61 # Only debug this one thread 62 debugger.SetDebugThreads({thread.get_ident():1}, 0) 60 63 61 64 # Start w/o connecting WingDBG/trunk/WingDBG.py
r152 r358 27 27 __doc__ = """Wing Debugger Service Module""" 28 28 29 __version__ = ' 2.1.0'29 __version__ = '3.0.0' 30 30 31 31 … … 68 68 69 69 self.reason = reason 70 sys.stderr.write(reason + '\n') 70 71 71 72 class IDEConnectionTimeOut(Exception): … … 165 166 def __init__(self): 166 167 if sys.platform == 'win32': 167 self.wing_home = r'c:\Program Files\Wing IDE 2.1'168 self.wing_home = r'c:\Program Files\Wing IDE 3.0' 168 169 elif sys.platform.startswith('darwin'): 169 170 self.wing_home = '/Applications/WingIDE.app/Contents/MacOS' 170 171 else: 171 self.wing_home = '/usr/lib/wingide 2.1'172 self.wing_home = '/usr/lib/wingide3.0' 172 173 173 174 winghome_file = os.path.join(PRODUCT_DIR, '.winghome') … … 234 235 security.declareProtected(VIEW_PERMISSION, 'wingDebugPwIsValid') 235 236 def wingDebugPwIsValid(self): 236 """Return true if .wingdebugpw can be found"""237 """Return true if wingdebugpw can be found""" 237 238 dir = self.getProfileDir() 238 return dir and os.path.isfile(os.path.join(dir, ' .wingdebugpw'))239 return dir and os.path.isfile(os.path.join(dir, 'wingdebugpw')) 239 240 240 241 # … … 316 317 gHttpServer.RunOnDebugThread(cb) 317 318 318 # Wait up to 3 secondsfor connection319 # Wait up for connection 319 320 start_time = time.time() 320 321 while time.time() < start_time + 5 and not status['completed']: … … 335 336 raise CannotStartDebugger('Cannot find wingdb.py in $(WINGHOME)/src or' 336 337 ' $(WINGHOME)/bin') 337 338 339 try: 340 exec_dict = {} 341 execfile(os.path.join(winghome, 'bin', '_patchsupport.py'), exec_dict) 342 find_matching = exec_dict['FindMatching'] 343 dir_list = find_matching('bin', internal_home, user_settings=None) 344 except Exception: 345 dir_list = [] 346 347 dir_list.extend([os.path.join(internal_home, 'bin'), 348 os.path.join(internal_home, 'src')]) 338 349 wingdb = None 339 for path in [os.path.join(internal_home, 'bin'), 340 os.path.join(internal_home, 'src')]: 350 for path in dir_list: 341 351 try: 342 352 f, p, d = imp.find_module('wingdb', [path]) … … 371 381 tracer.set_always_stop_excepts(()) 372 382 tracer.set_never_stop_excepts(()) 383 384 # Stop tracing 385 tracer.stop_trace() 386 373 387 # Unload modules 374 388 for name in ('wingdb', 'netserver'): … … 434 448 ' Advanced Settings page.') 435 449 if pw_path: # Always either empty or length 1 436 pathname = os.path.join(pw_path[0], ' .wingdebugpw')450 pathname = os.path.join(pw_path[0], 'wingdebugpw') 437 451 if not os.access(pathname, os.R_OK): 438 452 msg = ('Cannot create debugger because "%s"' 439 453 ' cannot be read.\nPlease make sure the user %s' 440 454 ' can read the file or change the directory that' 441 ' .wingdebugpw is read from via the Connection'455 ' wingdebugpw is read from via the Connection' 442 456 ' Security options in the Advanced Settings page.' 443 457 % (pathname, getUsername(gNetServer) or '<unknown>')) … … 669 683 def getDisplayValue(self, field, value): 670 684 if field == 'pw_mode': 671 return ('From $WINGHOME', 'From custom directory',685 return ('From User Settings Directory', 'From custom directory', 672 686 'Custom password and scrambling mode')[value] 673 687 if field == 'custom_encrypt_type': WingDBG/trunk/ZopeLogFile.py
r157 r358 35 35 36 36 class ZopeLogFile: 37 """File-like object that sends all data written to it to the logging module38 (which zope will have handlers configured for).37 """File-like object that sends all data written to it to the Zope eventlog 38 (which Zope will have handlers configured for). 39 39 40 40 Data is collected and logged as summary lines whenever a newline is … … 58 58 logger = logging.getLogger(self.subsystem) 59 59 logger.log(self.severity, line) 60 61 WingDBG/trunk/documentation/wingdbgdocs.html
r87 r358 10 10 <body> 11 11 <div class="document"> 12 <div class="note"> 13 <p class="first admonition-title">Note</p> 14 <p class="last"><strong>"The best solution for debugging Zope and Plone"</strong> 15 <em>-- Joel Burton, Member, Plone Team, Jul 2005</em></p> 16 </div> 12 17 <p><a class="reference" href="http://wingware.com/wingide">Wing IDE</a> can be used to develop and debug Python code running under 13 Zope2 , including Products, External Methods, file system-based Scripts18 Zope2 or Zope3, including Products, External Methods, file system-based Scripts 14 19 and Zope itself. It is also useful for Zope-based frameworks like 15 20 <a class="reference" href="http://www.plone.org/">Plone</a> (see <a class="reference" href="http://wingware.com/doc/howtos/plone">Plone Quickstart</a>).</p> … … 18 23 with Zope's code reloading features to achieve a very short edit/debug 19 24 cycle.</p> 20 <p><strong>Limitations:</strong> Wing IDE cannot debug DTML or Python code that is not 21 stored on the file system.</p> 25 <div class="note"> 26 <p class="first admonition-title">Note</p> 27 <p><strong>Note:</strong> This guide is for Zope2 users. If you are using Zope3, please 28 try <a class="reference" href="http://www.zopatista.com/projects/z3wingdbg">z3wingdbg</a> by Martijn Pieters or refer to <a class="reference" href="http://wingware.com/doc/debug/debugging-externally-launched-code">Debugging Externally 29 Launched Code</a> in the users manual top set up Zope3 debugging manually.</p> 30 </div> 31 <p><strong>Limitations:</strong> Wing IDE cannot debug DTML, Page Templates, ZCML, 32 or Python code that is not stored on the file system.</p> 22 33 <p><strong>Security Warning:</strong> We advise against using the WingDBG product 23 34 on production web servers. Any user connected to the Wing IDE debugger 24 35 will (unavoidably) have extensive access to files and data on the system.</p> 25 <div class="note">26 <p class="first admonition-title">Note</p>27 <p><strong>Note:</strong> This guide is for Zope2 users. If you are using Zope3, please28 refer to <a class="reference" href="http://wingware.com/doc/debug/debugging-externally-launched-code">Debugging Externally Launched Code</a> in the users manual.</p>29 </div>30 36 <div class="section" id="quick-start-on-a-single-host"> 31 37 <h1><a name="quick-start-on-a-single-host">Quick Start on a Single Host</a></h1> 32 38 <p>To use Wing IDE with Zope running on the same host as the IDE:</p> 33 <ul> 34 <li><p class="first"><strong>Install Zope</strong> -- You can obtain Zope from <a class="reference" href="http://www.zope.org">zope.org</a>. Version 35 2.5.1 or newer will work with Wing.</p> 36 </li> 37 <li><p class="first"><strong>Install Wing IDE</strong> -- You will need <a class="reference" href="http://wingware.com/downloads">Wing IDE</a> 2.0.2 or later. 38 See <a class="reference" href="http://wingware.com/doc/install/installing">Installing</a> for details.</p> 39 </li> 40 <li><p class="first"><strong>Configure Wing IDE</strong> -- Start Wing, create or open the project you 39 <ul class="simple"> 40 <li><strong>Install Zope</strong> -- You can obtain Zope from <a class="reference" href="http://www.zope.org">zope.org</a>. Version 41 2.5.1 or newer will work with Wing.</li> 42 <li><strong>Install Wing IDE</strong> -- You will need <a class="reference" href="http://wingware.com/downloads">Wing IDE</a> 2.1 or later. 43 See <a class="reference" href="http://wingware.com/doc/install/installing">Installing</a> for details.</li> 44 <li><strong>Configure Wing IDE</strong> -- Start Wing, create or open the project you 41 45 wish to use (from the <tt class="docutils literal"><span class="pre">Project</span></tt> menu). Then use the <tt class="docutils literal"><span class="pre">Extensions</span></tt> 42 46 tab in <tt class="docutils literal"><span class="pre">Project</span> <span class="pre">Properties</span></tt> to enable <tt class="literal"><span class="pre">Zope2/Plone support</span></tt> and to 43 47 specify the <tt class="literal"><span class="pre">Zope2 Instance Home</span></tt> to use with the project. Wing 44 48 will find your Zope installation by reading the file <tt class="docutils literal"><span class="pre">etc/zope.conf</span></tt> 45 in the provided Zope instance.</p> 46 <p>Once you press <tt class="docutils literal"><span class="pre">Apply</span></tt> or <tt class="docutils literal"><span class="pre">OK</span></tt> in the Project Properties 47 dialog, Wing will ask to install the WingDBG product and will 48 offer to add files from your Zope installation to the project.</p> 49 </li> 50 <li><p class="first"><strong>Configure the WingDBG Product</strong> -- Start or restart Zope and 49 in the provided Zope instance. Once you press <tt class="docutils literal"><span class="pre">Apply</span></tt> or <tt class="docutils literal"><span class="pre">OK</span></tt> in the Project 50 Properties dialog, Wing will ask to install the WingDBG product and will 51 offer to add files from your Zope installation to the project.</li> 52 <li><strong>Configure the WingDBG Product</strong> -- Start or restart Zope and 51 53 log into <a class="reference" href="http://localhost:8080/manage">http://localhost:8080/manage</a> (assuming default Zope 52 54 configuration). The Wing Debugging Service will be created automatically 53 on startup; you can find it under the Control Panel of your server.</p> 54 </li> 55 on startup; you can find it under the Control Panel of your server.</li> 55 56 </ul> 56 57 </div> … … 60 61 selecting the 'Wing Debugging Service'. Click in the "Start" button. The Wing 61 62 IDE status area should display "Debugger: Debug process running".</p> 63 <p>Note that you can configure WingDBG to start and connect to the IDE automatically 64 when Zope is started from the Advanced configuration tab.</p> 62 65 <p><strong>Problems?</strong> See the Trouble-Shooting Guide below.</p> 63 66 </div> … … 142 145 <p>When this is not possible, you can set up Wing to debug Zope running 143 146 on another machine, as described below:</p> 144 <ul >145 <li>< p class="first"><strong>Set up File Sharing</strong> -- You will need some mechanism for147 <ul class="simple"> 148 <li><strong>Set up File Sharing</strong> -- You will need some mechanism for 146 149 sharing files between the Zope host and the Wing IDE host. Windows file 147 150 sharing, Samba, NFS, and ftp or rsync mirroring are all options. 148 For secure file sharing via SSH on Linux, try <a class="reference" href="http://fuse.sourceforge.net/sshfs.html">sshfs</a>.</p> 149 </li> 150 <li><p class="first"><strong>Install Wing on Server</strong> -- You will also need to install Wing on 151 For secure file sharing via SSH on Linux, try <a class="reference" href="http://fuse.sourceforge.net/sshfs.html">sshfs</a>.</li> 152 <li><strong>Install Wing on Server</strong> -- You will also need to install Wing on 151 153 the host where Zope is running, if it is not already there. No 152 154 license is needed for this installation, unless you plan to also 153 run the IDE there.</p> 154 <p>If there is no binary distribution of Wing available for the 155 run the IDE there. If there is no binary distribution of Wing available for the 155 156 operating system where Zope is running, you can instead install only 156 157 the debugger libraries as outlined in <a class="reference" href="http://wingware.com/doc/howtos/compiling-debugger-sources">Compiling the Wing IDE 157 Debugger from Source</a>.</p> 158 </li> 159 <li><p class="first"><strong>Basic Configuration</strong> -- Follow the instructions for Single-Host 158 Debugger from Source</a>.</li> 159 <li><strong>Basic Configuration</strong> -- Follow the instructions for Single-Host 160 160 Debugging above first if you have not already done so. Then return here 161 for additional setup instructions.</p> 162 </li> 163 <li><p class="first"><strong>Configure Allowed Hosts</strong> -- You will need to add the IP address of 161 for additional setup instructions.</li> 162 <li><strong>Configure Allowed Hosts</strong> -- You will need to add the IP address of 164 163 the Zope host to the <tt class="literal"><span class="pre">Allowed Hosts</span></tt> preference in Wing. Otherwise 165 Wing will not accept your debug connections.</p> 166 </li> 167 <li><p class="first"><strong>Configure File Mapping</strong> -- Next, set up a mapping between the location 164 Wing will not accept your debug connections.</li> 165 <li><strong>Configure File Mapping</strong> -- Next, set up a mapping between the location 168 166 of the Zope installation on your Zope host and the point where it is 169 accessible on you Wing IDE host.</p> 170 <p>For example, if your Zope host is <tt class="docutils literal"><span class="pre">192.168.1.1</span></tt> Zope is installed in 167 accessible on you Wing IDE host. For example, if your Zope host is <tt class="docutils literal"><span class="pre">192.168.1.1</span></tt> Zope is installed in 171 168 <tt class="docutils literal"><span class="pre">/home/myuser/Zope</span></tt> on that machine, and <tt class="docutils literal"><span class="pre">/home/myuser</span></tt> is mounted on your 172 169 Wing IDE host as <tt class="docutils literal"><span class="pre">e:</span></tt>, you would add a <tt class="literal"><span class="pre">Location Map</span></tt> preference setting 173 that maps <tt class="docutils literal"><span class="pre">192.168.1.1</span></tt> to a list containing <tt class="docutils literal"><span class="pre">/home/myuser/Zope</span></tt> and <tt class="docutils literal"><span class="pre">file:e:/Zope</span></tt>.</p> 174 <p>For more information on this, see <a class="reference" href="http://wingware.com/doc/debug/file-location-maps">File Location Maps</a> and <a class="reference" href="http://wingware.com/doc/debug/file-location-map-example">Location Map Examples</a> 175 in the Wing IDE manual.</p> 176 </li> 177 <li><p class="first"><strong>Modify WingDBG Configuration</strong> -- When debugging remotely, the value 170 that maps <tt class="docutils literal"><span class="pre">192.168.1.1</span></tt> to a list containing <tt class="docutils literal"><span class="pre">/home/myuser/Zope</span></tt> and <tt class="docutils literal"><span class="pre">file:e:/Zope</span></tt>. 171 For more information on this, see <a class="reference" href="http://wingware.com/doc/debug/file-location-maps">File Location Maps</a> and <a class="reference" href="http://wingware.com/doc/debug/file-location-map-example">Location Map Examples</a> 172 in the Wing IDE manual.</li> 173 <li><strong>Modify WingDBG Configuration</strong> -- When debugging remotely, the value 178 174 given to WingDBG for the Wing Home Directory must be the location 179 175 where Wing is installed on the Zope host (the default value will 180 usually need to be changed).</p> 181 </li> 182 <li><p class="first"><strong>Check Project Configuration</strong> -- Similarly, the paths identified 176 usually need to be changed).</li> 177 <li><strong>Check Project Configuration</strong> -- Similarly, the paths identified 183 178 in Project Properties should be those on the host where Wing 184 IDE is running, not the paths on the Zope host.</p> 185 </li> 179 IDE is running, not the paths on the Zope host.</li> 186 180 </ul> 187 181 </div> … … 190 184 <p>You can obtain additional verbose output from Wing IDE and the debug 191 185 process as follows:</p> 192 <ul> 193 <li><p class="first">Go into the Wing Debugging Service in the Zope Management Interface and set <tt class="docutils literal"><span class="pre">Log</span> 186 <ul class="simple"> 187 <li>If Zope or Plone on Windows is yielding a Site Error page with a notFoundError 188 when run under Wing's debugger, you may need to go into the Zope Management 189 Interface and delete the access rule (... accessRule.py ...). Now, Zope/Plone runs 190 on port 8080, does not alter the configuration of port 80, and will work properly 191 with Wing's debug port (50080 by default). If the URL for your front page 192 is <a class="reference" href="http://localhost:8080/default/front-page">http://localhost:8080/default/front-page</a>, the Wing IDE debug url will always 193 be the same but with the different port: <a class="reference" href="http://localhost:50080/default/front-page">http://localhost:50080/default/front-page</a> 194 (Thanks for Joel Burton for this tip!)</li> 195 <li>Go into the Wing Debugging Service in the Zope Management Interface and set <tt class="docutils literal"><span class="pre">Log</span> 194 196 <span class="pre">file</span></tt> under the <tt class="docutils literal"><span class="pre">Configure</span></tt> tab. Using <tt class="docutils literal"><span class="pre"><stdout></span></tt> will cause 195 197 logging information to be printed to the console from which Zope was 196 started.</p> 197 <p>Alternatively, set this to the full path of a log file. This file must already 198 exist for logging to occur.</p> 199 </li> 200 <li><p class="first">Restart Zope and Wing and try to initiate debug.</p> 201 </li> 202 <li><p class="first">Inspect the contents of the log. If you are running Zope and Wing IDE on two 198 started. Alternatively, set this to the full path of a log file. This file must already 199 exist for logging to occur.</li> 200 <li>Restart Zope and Wing and try to initiate debug.</li> 201 <li>Inspect the contents of the log. If you are running Zope and Wing IDE on two 203 202 separate hosts, you should also inspect the <tt class="docutils literal"><span class="pre">error-log</span></tt> file on the Wing IDE 204 203 host (located in the <a class="reference" href="http://wingware.com/doc/install/user-settings-dir">User Settings Directory</a>). It contains additional 205 logging information from the Wing IDE process.</p> 206 </li> 204 logging information from the Wing IDE process.</li> 207 205 </ul> 208 206 <p>For additional help, send these errors logs to <a class="reference" href="mailto:support@wingware.com">support at wingware.com</a>.</p> WingDBG/trunk/utils.py
r88 r358 63 63 """Get the Wing IDE profile directory for the current user. 64 64 65 If the debugger core has not been loaded yet, this may not be pr cisely65 If the debugger core has not been loaded yet, this may not be precisely 66 66 correct because of the absence of a GetUserName function on win32. 67 67 Returns None if the dir doesn't and can't exist -- this occurs on … … 81 81 # On posix; use the expand path methodology and detect when that fails 82 82 # or opens up a security problem (home set to /) 83 path = os.path.expanduser('~/.wingide 2')84 if path in ('~/.wingide 2', '/.wingide2'):83 path = os.path.expanduser('~/.wingide3') 84 if path in ('~/.wingide3', '/.wingide3'): 85 85 return None 86 86 return path WingDBG/trunk/www/advanced.pt
r153 r358 120 120 checked python:here.pw_mode == PW_MODE_PROFILE_DIR; 121 121 tabindex python:tabindex.next() and tabindex.item" /> 122 From .wingdebugpw in $WINGHOME(<span123 tal:replace="here/getProfileDir">$ WINGHOME</span>)122 From wingdebugpw in User Settings Directory (<span 123 tal:replace="here/getProfileDir">$USERWINGDIR</span>) 124 124 </div> 125 125 <div class="form-element"> … … 130 130 checked python:here.pw_mode == PW_MODE_CUSTOM_DIR; 131 131 tabindex python:tabindex.next() and tabindex.item" /> 132 From .wingdebugpw in132 From wingdebugpw in 133 133 <input type="text" class="form-element" name="pw_dir" value="" 134 134 id="pw_dir" size="20" style="width: 18em;" tabindex="" WingDBG/trunk/www/connection_trouble_help.pt
r60 r358 15 15 <span tal:replace="here/ide_host">host</span>.</strong> 16 16 17 <p>Make sure Wing IDE is showing "Debugger: Ready and listening" and you 17 <p>Make sure Wing IDE is showing "No debug process / listening for 18 connections on TCP/IP port <span tal:replace="here/ide_port">port</span>" 19 in the status bar bug button's tooltip and you 18 20 have enabled Zope support from the Extensions tab of Project Properties 19 21 in Wing IDE.</p> … … 34 36 <strong tal:condition="python:here.pw_mode in (0, 1)"> 35 37 <tal:line condition="here/wingDebugPwIsValid">Invalid 36 <code> .wingdebugpw</code> file in the38 <code>wingdebugpw</code> file in the 37 39 <span tal:replace="python:test(here.pw_mode, here.pw_dir, 38 40 here.getProfileDir())">dir</span> 39 41 directory.</tal:line> 40 42 <tal:line condition="not:here/wingDebugPwIsValid">Missing 41 <code> .wingdebugpw</code>file.</tal:line>43 <code>wingdebugpw</code>file.</tal:line> 42 44 </strong> 43 45 <strong tal:condition="python:here.pw_mode == 2">Data scrambling and … … 45 47 IDE</strong> 46 48 47 <p>When present, the <code> .wingdebugpw</code> file must match the file49 <p>When present, the <code>wingdebugpw</code> file must match the file 48 50 in the User Settings Directory for the user running Wing IDE.</p> 49 51 </li>
