Changeset 168

Show
Ignore:
Timestamp:
03/22/06 12:58:45 (3 years ago)
Author:
abaxter
Message:

whitespace normalisation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pyramid/build.py

    r167 r168  
    2525class Dumper(syck.Dumper): 
    2626    def represent_pyramid_path_path(self, object): 
    27         return syck.Scalar(object,  
     27        return syck.Scalar(object, 
    2828                    tag="tag:python.yaml.org,2002:object:pyramid.path.path") 
    2929    def represent_nevow_stan_xml(self, object): 
     
    3333 
    3434 
    35 def build(data, out, verbose=0, resourcedirs=[], rebuilddirs=None,  
    36           partialbuild=False, constants=None, update=False,  
     35def build(data, out, verbose=0, resourcedirs=[], rebuilddirs=None, 
     36          partialbuild=False, constants=None, update=False, 
    3737          createcache=False): 
    3838 
     
    6363    for resourcedir in resourcedirs: 
    6464        dir, name = os.path.split(resourcedir) 
    65         utils.copytree(resourcedir, opjoin(OUTPUTDIR, name),  
     65        utils.copytree(resourcedir, opjoin(OUTPUTDIR, name), 
    6666                       nocopylist=['.svn']) 
    6767 
     
    7272    # initialise a context 
    7373    ctx = Context() 
    74     # set the root data key to an empty dictionary (the first level acquires  
     74    # set the root data key to an empty dictionary (the first level acquires 
    7575    # from this) 
    7676    ctx.data = { '': {} } 
     
    126126        nobuild = path(root) / 'NOBUILD' 
    127127        if nobuild.isfile(): 
    128             utils.copytree(root, opjoin(OUTPUTDIR, root),  
     128            utils.copytree(root, opjoin(OUTPUTDIR, root), 
    129129                           nocopylist=['.svn']) 
    130130            continue 
     
    134134            ctx = pickle.load(open(cachepath)) 
    135135            ctx.partialbuild = True 
    136             html = flat.flatten( [DOCTYPE,  
     136            html = flat.flatten( [DOCTYPE, 
    137137                        flatten(ctx.data[ctx.relpath]['index.yml'], ctx)] ) 
    138138            file(opjoin(OUTPUTDIR, root, 'index.html'), 'w').write(html) 
     
    148148 
    149149                try: 
    150                     html = flat.flatten( [DOCTYPE,  
     150                    html = flat.flatten( [DOCTYPE, 
    151151                            flatten(Y.fragmentConstructor( 
    152152                                    opjoin(root, 'index.yml')), ctx)] ) 
     
    193193 
    194194 
    195     build(options.data, options.out, verbose=options.verbose,  
    196           resourcedirs=resourcedirs, rebuilddirs=rebuilddirs,  
    197           constants=constants, update=options.update,  
     195    build(options.data, options.out, verbose=options.verbose, 
     196          resourcedirs=resourcedirs, rebuilddirs=rebuilddirs, 
     197          constants=constants, update=options.update, 
    198198          createcache=options.createcache) 
    199199 
     
    201201def parseOptions(): 
    202202    parser = OptionParser() 
    203     parser.add_option("-d", "--data", dest="data",  
    204         help="directory in which the fragment data is stored",  
     203    parser.add_option("-d", "--data", dest="data", 
     204        help="directory in which the fragment data is stored", 
    205205        metavar="DATA") 
    206     parser.add_option("-o", "--out", dest="out",  
    207         help="directory in which to save output (will be emptied)",  
     206    parser.add_option("-o", "--out", dest="out", 
     207        help="directory in which to save output (will be emptied)", 
    208208        metavar="OUT") 
    209     parser.add_option("-r", "--resources", dest="resources",  
    210         help="comma separated list of resource directories to copy",  
     209    parser.add_option("-r", "--resources", dest="resources", 
     210        help="comma separated list of resource directories to copy", 
    211211        metavar="RESOURCES") 
    212     parser.add_option("-v", "--verbose", action="store_const",  
    213         dest="verbose", default=0, const=1,  
     212    parser.add_option("-v", "--verbose", action="store_const", 
     213        dest="verbose", default=0, const=1, 
    214214        help="print status messages to stdout") 
    215     parser.add_option("-V", "--veryverbose", action="store_const",  
     215    parser.add_option("-V", "--veryverbose", action="store_const", 
    216216        dest="verbose", default=0, const=2, help="print all data to stdout") 
    217     parser.add_option("-W", "--veryveryverbose", action="store_const",  
     217    parser.add_option("-W", "--veryveryverbose", action="store_const", 
    218218        dest="verbose", default=0, const=3, help="print all data to stdout") 
    219     parser.add_option("-R",  "--rebuilddirs", dest="rebuilddirs",  
    220         help="only rebuild below these comma separated directories",  
     219    parser.add_option("-R",  "--rebuilddirs", dest="rebuilddirs", 
     220        help="only rebuild below these comma separated directories", 
    221221        metavar="REBUILDDIRS") 
    222     parser.add_option("-C",  "--createcache", action="store_true",  
    223         dest="createcache", default=False, help="recreate the cache files",  
     222    parser.add_option("-C",  "--createcache", action="store_true", 
     223        dest="createcache", default=False, help="recreate the cache files", 
    224224        metavar="CREATECACHE") 
    225     parser.add_option("-c", "--constants", dest="constants",  
    226         help="pass in the names constants (e.g. PDO=/root/pdo,PSF=/psf",  
     225    parser.add_option("-c", "--constants", dest="constants", 
     226        help="pass in the names constants (e.g. PDO=/root/pdo,PSF=/psf", 
    227227        metavar="CONSTANTS") 
    228     parser.add_option("-U", "--update", action="store_true", dest="update",  
    229         default=False,  
     228    parser.add_option("-U", "--update", action="store_true", dest="update", 
     229        default=False, 
    230230        help="NOT WORKING DO NOT USE try to build only those pages that have changed") 
    231231    (options, args) = parser.parse_args() 
  • trunk/pyramid/dictutils.py

    r166 r168  
    55def merge(a, b, dir=None, partialbuild=False): 
    66 
    7     if (isinstance(a, Y.sectionnav) and  
     7    if (isinstance(a, Y.sectionnav) and 
    88        isinstance(b, Y.sectionnav) and dir is not None): 
    9         # special case. If b is the same as a, it has been inhereited -  
     9        # special case. If b is the same as a, it has been inhereited - 
    1010        # sectionnav's should not inherit in this fashion however 
    11         # TODO: this fix might cause problems in the future. e.g. if  
     11        # TODO: this fix might cause problems in the future. e.g. if 
    1212        # the second level nav were exactly the same as the first level nav? 
    1313        if a == b: 
     
    2121        for bkey in b.keys(): 
    2222            if a.has_key(bkey): 
    23                 a[bkey] = merge(a[bkey], b[bkey], dir,  
     23                a[bkey] = merge(a[bkey], b[bkey], dir, 
    2424                                partialbuild=partialbuild) 
    2525            else: 
  • trunk/pyramid/test/tests.py

    r162 r168  
    2222    if os.path.exists(dir): 
    2323        removeTemp(dir) 
    24     os.mkdir(dir)      
     24    os.mkdir(dir) 
    2525 
    2626def tree_from_stream(stream, 
     
    9696    fh1 = StringIO(text1) 
    9797    fh2 = StringIO(text2) 
    98      
     98 
    9999    # convert xml files to tree 
    100100    try: 
     
    133133        except ImportError: 
    134134            from logilab.xmldiff.ezs import EzsCorrector 
    135              
     135 
    136136        strategy = EzsCorrector(formatter) 
    137137    else: 
     
    175175                        print filetext2 
    176176                        print '#'*80 
    177                         print '%s\n Differences in generated output for %s\n%s' % ('='*70,relpath / file,'='*70)   
     177                        print '%s\n Differences in generated output for %s\n%s' % ('='*70,relpath / file,'='*70) 
    178178                        from pprint import pprint 
    179179                        pprint(result) 
     
    183183 
    184184class test_yamlRegistry(unittest.TestCase): 
    185      
    186     def test_url(self):                           
     185 
     186    def test_url(self): 
    187187        """ url constructor 
    188188        """ 
     
    190190        expected = {'href':Y.ahref('/link'), 'label':'My Link'} 
    191191        self.assertEqual(data,expected) 
    192   
     192 
    193193 
    194194class test_flatteners(unittest.TestCase): 
    195      
    196     def test_ahref(self):                           
     195 
     196    def test_ahref(self): 
    197197        """ absolute href 
    198198        """ 
     
    201201        self.assertEqual(flatteners.flatten(data,ctx), '/about') 
    202202 
    203     def test_rhref(self):                           
     203    def test_rhref(self): 
    204204        """ relative href 
    205205        """ 
     
    208208        self.assertEqual(flatteners.flatten(data,ctx), '/about') 
    209209 
    210              
    211     def test_url(self):                           
     210 
     211    def test_url(self): 
    212212        """ url 
    213213        """ 
     
    216216        expected = {'href':'/link', 'label':'My Link'} 
    217217        self.assertEqual(flatteners.flatten(data,ctx),expected) 
    218   
     218 
    219219 
    220220class test_build(unittest.TestCase): 
    221      
     221 
    222222    buildtestroot = 'build_tests' 
    223223    buildtestpath = path.path(os.getcwd()) / 'pyramid' / 'test' / testdatadir / buildtestroot 
    224      
     224 
    225225    def setUp(self): 
    226226        """ Create test folders 
     
    228228        makeAndCleanTemp(TEMPFOLDER) 
    229229 
    230      
     230 
    231231    def test_basic(self): 
    232232        """ 
     
    234234        skipdirs = ['.svn'] 
    235235        tests = [d for d in os.listdir(self.buildtestpath) if d != '.svn'] 
    236          
     236 
    237237        for buildtest in tests: 
    238238            print 'testing %s' % buildtest 
     
    240240            checkedresultpath = self.buildtestpath / buildtest / 'expected' 
    241241            build.build(datapath,TEMPFOLDER / buildtest,createcache=True) 
    242              
     242 
    243243            self.assertEqual(compareDirs(TEMPFOLDER / buildtest,checkedresultpath,skipdirs,['.cache.dump']),True) 
    244244            self.assertEqual(compareDirs(TEMPFOLDER / buildtest,checkedresultpath,skipdirs),True) 
    245              
     245 
    246246 
    247247            configfilename = self.buildtestpath / buildtest / 'config.yml' 
     
    251251                self.assertEqual(compareDirs(TEMPFOLDER / buildtest,checkedresultpath,skipdirs,['.cache.dump']),True) 
    252252                self.assertEqual(compareDirs(TEMPFOLDER / buildtest,checkedresultpath,skipdirs),True) 
    253              
    254                   
     253 
     254 
    255255    def tearDown(self): 
    256256        """ remove all test folders 
    257257        """ 
    258         #removeTemp(TEMPFOLDER)          
    259      
     258        #removeTemp(TEMPFOLDER) 
     259 
    260260if __name__ == "__main__": 
    261     unittest.main()        
     261    unittest.main()