Changeset 297:0df29400e6b8

Show
Ignore:
Timestamp:
2007-08-31 18:14:37 (1 year ago)
Author:
Stefan Schwarzer <sschwarzer@sschwarzer.net>
branch:
default
Message:
Made all imports relative (apart from those in the
`wsbrowser`/`wsbrowser.py` scripts, where they're necessary).

The former approach of using only absolute imports was kind of
cleaner, especially with respect to future Python versions. - However,
the absolute imports were also _very_ confusing (even for me) and
required a funny workaround for development if a Websourcebrowser
package was already installed somewhere in `sys.path`.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • MANIFEST

    r291 r297  
    77config.py 
    88converter.py 
    9 ifdevel.py 
    109pygmentsfinder.py 
    1110session.py 
  • README.txt

    r289 r297  
    5353Subversion_ and Mercurial_, and Vim_ swap files. 
    5454 
    55 The second environment variable is ``WSB_DEVEL`` which is primarily 
    56 interesting for Websourcebrowser developers. If set to 1, don't use an 
    57 installed Websourcebrowser package but the directory 
    58 ``websourcebrowser`` which has to be the current directory. 
    59  
    6055To get help for the command line options, invoke the installed program 
    6156with the ``help`` option:: 
     
    8681Though it's recommended, you don't *have to* install Websourcebrowser. 
    8782Instead you can get away with extracting the source archive (see 
    88 below), renaming the ``websourcebrowser-version`` directory to just 
    89 ``websourcebrowser`` and adding the directory -- without the trailing 
    90 ``websourcebrowser`` part -- to the ``PYTHONPATH`` environment 
    91 variable. For example, if the directory is 
    92 ``/home/me/downloads/websourcebrowser``, add ``/home/me/downloads`` to 
     83below) and adding the extracted directory to the ``PYTHONPATH`` 
     84environment variable. For example, if the directory is 
     85``/home/me/downloads/websourcebrowser-0.2``, add that to 
    9386``PYTHONPATH``. 
    9487 
  • browser.py

    r292 r297  
    3333import urlparse 
    3434 
    35 from websourcebrowser import coding 
    36 from websourcebrowser import config 
    37 from websourcebrowser import converter 
    38 from websourcebrowser import pygmentsfinder 
    39 from websourcebrowser import session 
    40 from websourcebrowser import template 
    41 from websourcebrowser import urlpath 
     35# Websourcebrowser modules 
     36import coding 
     37import config 
     38import converter 
     39import pygmentsfinder 
     40import session 
     41import template 
     42import urlpath 
    4243 
    4344 
  • config.py

    r296 r297  
    3131import sys 
    3232 
    33 from websourcebrowser import coding 
    34 from websourcebrowser import tools 
     33# Websourcebrowser modules 
     34import coding 
     35import tools 
    3536 
    3637# 
  • converter.py

    r296 r297  
    3333import sys 
    3434 
    35 from websourcebrowser import coding 
    36 from websourcebrowser import config 
    37 from websourcebrowser import pygmentsfinder 
    38 from websourcebrowser import session 
    39 from websourcebrowser import tools 
    40 from websourcebrowser import urlpath 
     35# Websourcebrowser modules 
     36import coding 
     37import config 
     38import pygmentsfinder 
     39import session 
     40import tools 
     41import urlpath 
    4142 
    4243 
  • scripts/wsbrowser

    r270 r297  
    2525import sys 
    2626 
    27 # has to come first 
    28 from websourcebrowser import ifdevel 
    29 del sys.modules['websourcebrowser'] 
    30  
     27# for development, invoke file `browser.py` directly 
    3128from websourcebrowser import browser 
    3229 
  • session.py

    r280 r297  
    2626import urlparse 
    2727 
    28 from websourcebrowser import coding 
    29 from websourcebrowser import config 
     28# Websourcebrowser modules 
     29import coding 
     30import config 
    3031 
    3132 
  • test.py

    r270 r297  
    3434del sys.modules['websourcebrowser'] 
    3535 
    36 # modules that are part of Websourcebrowser 
    37 from websourcebrowser import coding 
    38 from websourcebrowser import config 
    39 from websourcebrowser import converter 
    40 from websourcebrowser import session 
    41 from websourcebrowser import urlpath 
     36# Websourcebrowser modules 
     37import coding 
     38import config 
     39import converter 
     40import session 
     41import urlpath 
    4242 
    4343 
  • test_converter.txt

    r295 r297  
    1717path. The following tests are intended to run under Posix systems:: 
    1818 
    19     >>> from websourcebrowser import converter 
     19    >>> import converter 
    2020 
    2121    >>> converter.dir_level("/the/root/directory") 
     
    7676value of ``config.ignore_patterns`` which is a list of glob patterns:: 
    7777 
    78     >>> from websourcebrowser import config 
     78    >>> import config 
    7979    >>> config.ignore_patterns = ["*.pyc", "*.swp"] 
    8080    >>> for item in ("file.py", "file.pyc", "test.swpx", "test.swp"): 
  • test_session.txt

    r277 r297  
    1010a dictionary with the parameters from the query string of the URL. 
    1111 
    12     >>> from websourcebrowser import session 
     12    >>> import session 
    1313 
    1414Testing the constructor 
  • test_urlpath_posix.txt

    r260 r297  
    99So, let's begin: 
    1010 
    11     >>> from websourcebrowser import urlpath 
     11    >>> import urlpath 
    1212 
    1313Testing the ``is_safe_path`` function 
  • test_urlpath_windows.txt

    r260 r297  
    99So, let's begin: 
    1010 
    11     >>> from websourcebrowser import urlpath 
     11    >>> import urlpath 
    1212 
    1313Testing the ``is_safe_path`` function 
  • todo.txt

    r286 r297  
    3333- write tutorial? 
    3434 
     35- re-think supporting a configuration file 
    3536- improve running Websourcebrowser without installation 
    3637- rename parameter "dir_levels" to "dir_level" where appropriate 
     
    4647  archive) 
    4748 
    48 - restrict access to certain source IPs or address ranges (default 
    49   should be only localhost) 
    5049- prevent DOS attacks 
    5150  - limit size of displayed files, especially binary files displayed 
  • urlpath.py

    r291 r297  
    2626import urllib 
    2727 
    28 from websourcebrowser import tools 
     28# Websourcebrowser modules 
     29import tools 
    2930 
    3031