Changeset 1160

Show
Ignore:
Timestamp:
01/12/09 15:59:46 (3 years ago)
Author:
wyatt
Message:

Added setuptools namespacing machinery and updated all imports accordingly.

Files:
2 added
1 removed
53 modified
1 moved

Legend:

Unmodified
Added
Removed
  • Core/trunk/bycycle/core/model/__init__.py

    r1043 r1160  
    1818 
    1919""" 
    20 from byCycle import model_path 
    21 from byCycle.model.db import engine, connection, cursor, Session 
    22 from byCycle.model.entities import * 
    23 from byCycle.model.address import * 
     20from bycycle.core import model_path 
     21from bycycle.core.model.db import engine, connection, cursor, Session 
     22from bycycle.core.model.entities import * 
     23from bycycle.core.model.address import * 
  • Core/trunk/bycycle/core/model/address.py

    r1036 r1160  
    1313############################################################################### 
    1414"""Address classes.""" 
    15 from byCycle.util import joinAttrs 
    16 from byCycle.model.point import Point 
    17 from byCycle.model.entities import StreetName, Place 
     15from bycycle.core.util import joinAttrs 
     16from bycycle.core.model.point import Point 
     17from bycycle.core.model.entities import StreetName, Place 
    1818 
    1919__all__ = ['AddressError', 'Address', 'PostalAddress', 'EdgeAddress', 
  • Core/trunk/bycycle/core/model/compass.py

    r463 r1160  
    1111# NO WARRANTY OF ANY KIND. 
    1212############################################################################### 
    13 from byCycle.util import swapKeysAndValues 
     13from bycycle.core.util import swapKeysAndValues 
    1414 
    1515 
  • Core/trunk/bycycle/core/model/data/integrator.py

    r1096 r1160  
    4747from sqlalchemy import func, select, text, and_, or_ 
    4848 
    49 from byCycle.util import meter 
    50 from byCycle import model_path 
    51 from byCycle.model import db 
    52 from byCycle.model.entities import base, public 
    53 from byCycle.model.sttypes import street_types_ftoa 
     49from bycycle.core.util import meter 
     50from bycycle.core import model_path 
     51from bycycle.core.model import db 
     52from bycycle.core.model.entities import base, public 
     53from bycycle.core.model.sttypes import street_types_ftoa 
    5454 
    5555 
  • Core/trunk/bycycle/core/model/db.py

    r1057 r1160  
    2626from sqlalchemy import MetaData, orm, create_engine 
    2727 
    28 from byCycle import model_path 
     28from bycycle.core import model_path 
    2929 
    3030 
     
    225225if __name__ == '__main__': 
    226226    import sys 
    227     from byCycle import model 
     227    from bycycle.core import model 
    228228    try: 
    229229        action = sys.argv[1] 
  • Core/trunk/bycycle/core/model/entities/__init__.py

    r1034 r1160  
    1 from byCycle.model.entities.base import * 
    2 from byCycle.model.entities.public import * 
     1from bycycle.core.model.entities.base import * 
     2from bycycle.core.model.entities.public import * 
  • Core/trunk/bycycle/core/model/entities/base.py

    r1155 r1160  
    3030import simplejson 
    3131 
    32 from byCycle.util import gis, joinAttrs 
    33 from byCycle.model.db import engine, metadata, Session 
    34 from byCycle.model.entities.util import cascade_arg 
     32from bycycle.core.util import gis, joinAttrs 
     33from bycycle.core.model.db import engine, metadata, Session 
     34from bycycle.core.model.entities.util import cascade_arg 
    3535 
    3636 
  • Core/trunk/bycycle/core/model/entities/public.py

    r1155 r1160  
    2222import pyproj 
    2323 
    24 from byCycle import model_path 
    25 from byCycle.util import gis, joinAttrs 
    26 from byCycle.model import db 
    27 from byCycle.model.entities import DeclarativeBase 
    28 from byCycle.model.entities.util import cascade_arg, encodeFloat 
    29 from byCycle.model.data.sqltypes import POINT 
     24from bycycle.core import model_path 
     25from bycycle.core.util import gis, joinAttrs 
     26from bycycle.core.model import db 
     27from bycycle.core.model.entities import DeclarativeBase 
     28from bycycle.core.model.entities.util import cascade_arg, encodeFloat 
     29from bycycle.core.model.data.sqltypes import POINT 
    3030 
    3131__all__ = [ 
     
    186186 
    187187        """ 
    188         from byCycle.util.meter import Meter, Timer 
     188        from bycycle.core.util.meter import Meter, Timer 
    189189 
    190190        timer = Timer() 
     
    249249        module = getattr(self, '_module', None) 
    250250        if module is None: 
    251             path = 'byCycle.model.%s' % self.slug 
     251            path = 'bycycle.core.model.%s' % self.slug 
    252252            exec 'from %s import Node as _RegionNode' % path 
    253253            exec 'from %s import Edge as _RegionEdge' % path 
  • Core/trunk/bycycle/core/model/milwaukeewi/__init__.py

    r1155 r1160  
    1212# NO WARRANTY OF ANY KIND. 
    1313############################################################################### 
    14 from sqlalchemy.types import Integer, String, CHAR, Integer 
     14from sqlalchemy import Column, ForeignKey 
     15from sqlalchemy.types import Integer, CHAR 
    1516 
    16 from byCycle.util import gis 
    17 from byCycle.model import db 
    18 from byCycle.model.entities import base 
    19 from byCycle.model.entities.util import encodeFloat 
    20 from byCycle.model.entities.base import base_statements 
    21 from byCycle.model.data.sqltypes import POINT, LINESTRING 
    22 from byCycle.model.milwaukeewi.data import SRID, slug 
     17from bycycle.core.model import db 
     18from bycycle.core.model.entities import base 
     19from bycycle.core.model.entities.util import encodeFloat 
     20from bycycle.core.model.data.sqltypes import POINT, LINESTRING 
     21from bycycle.core.model.milwaukeewi.data import SRID, slug 
     22 
     23from dijkstar import infinity 
    2324 
    2425 
    25 __all__ = ['Edge', 'Node', 'StreetName', 'City', 'State', 'Place'] 
     26__all__ = ['MilwaukeeWINode', 'MilwaukeeWIEdge'] 
    2627 
    2728 
    28 class Edge(base.Edge): 
    29     base_statements('Edge') 
    30     has_field('geom', LINESTRING(SRID)) 
    31     has_field('code', CHAR(3)) 
    32     has_field('bikemode', CHAR(1))  # enum(t, r, l, p) 
    33     has_field('lanes', Integer) 
    34     has_field('adt', Integer) 
    35     has_field('spd', Integer) 
    36  
    37     @classmethod 
    38     def _adjustRowForMatrix(cls, row): 
    39         length = row.geom.length 
    40         return {'length': encodeFloat(length)} 
     29table_args = dict(schema='milwaukeewi') 
    4130 
    4231 
    43 class Node(base.Node): 
    44     base_statements('Node') 
    45     has_field('geom', POINT(SRID)) 
     32class MilwaukeeWINode(base.Node): 
     33    __tablename__ = 'nodes' 
     34    __table_args__ = table_args 
     35    __mapper_args__ = dict(polymorphic_identity='milwaukeewi_node') 
     36 
     37    id = Column(Integer, ForeignKey('public.nodes.id'), primary_key=True) 
     38    geom = Column(POINT(SRID)) 
    4639 
    4740    @property 
     
    4942        return super(Node, self).edges 
    5043 
    51  
    52 class StreetName(base.StreetName): 
    53     base_statements('StreetName') 
     44Node = MilwaukeeWINode 
    5445 
    5546 
    56 class City(base.City): 
    57     base_statements('City') 
     47class MilwaukeeWIEdge(base.Edge): 
     48    __tablename__ = 'edges' 
     49    __table_args__ = table_args 
     50    __mapper_args__ = dict(polymorphic_identity='milwaukeewi_edge') 
    5851 
     52    id = Column('id', Integer, ForeignKey('public.edges.id'), primary_key=True) 
     53    geom = Column(LINESTRING(SRID)) 
     54    code = Column(CHAR(3)) 
     55    bikemode = Column(CHAR(1))  # enum(t, r, l, p) 
     56    lanes = Column(Integer) 
     57    adt = Column(Integer) 
     58    spd = Column(Integer) 
    5959 
    60 class State(base.State): 
    61     base_statements('State') 
     60    @classmethod 
     61    def _adjustRowForMatrix(cls, row): 
     62        return {'length': encodeFloat(row.geom.length)} 
    6263 
    63  
    64 class Place(base.Place): 
    65     base_statements('Place') 
     64Edge = MilwaukeeWIEdge 
  • Core/trunk/bycycle/core/model/milwaukeewi/bicycle.py

    r912 r1160  
    77# Copyright (C) 2006, 2007 Wyatt Baldwin, byCycle.org <wyatt@bycycle.org>. 
    88# All rights reserved. 
    9 #  
     9# 
    1010# For terms of use and warranty details, please see the LICENSE file included 
    1111# in the top level of this distribution. This software is provided AS IS with 
     
    1313############################################################################### 
    1414"""Bicycle travel mode for Milwaukee, WI, region.""" 
    15 from byCycle.model import tmode 
    16 from byCycle.model.entities.util import float_decode 
     15from bycycle.core.model import tmode 
     16from bycycle.core.model.entities.util import float_decode 
    1717 
    1818 
  • Core/trunk/bycycle/core/model/milwaukeewi/data/__init__.py

    r1034 r1160  
    1313############################################################################### 
    1414"""This package contains everything to do with this region's data and DB.""" 
    15 from elixir import Entity, using_options, using_table_options 
    16 from elixir import has_field 
    17 from elixir import Integer, String, Integer, Float 
     15from sqlalchemy import Column 
     16from sqlalchemy.types import Integer, String, Integer, Float, Numeric 
    1817 
    19 from byCycle.model import db 
    20 from byCycle.model.data.sqltypes import MULTILINESTRING 
     18from bycycle.core.model import db 
     19from bycycle.core.model.entities import DeclarativeBase 
     20from bycycle.core.model.data.sqltypes import MULTILINESTRING 
    2121 
    2222__all__ = ['title', 'slug', 'SRID', 'units', 'earth_circumference', 
     
    7373} 
    7474 
    75 class Raw(Entity): 
    76     using_options(tablename=slug) 
    77     using_table_options(schema='raw') 
     75class Raw(DeclarativeBase): 
     76    __tablename__ = slug 
     77    __table_args__ = dict(schema='raw') 
    7878 
    79     has_field('gid', Integer, primary_key=True, key='id') 
     79    gid = Column(Integer, primary_key=True, key='id') 
    8080 
    81     # To edge table (core) 
    82     has_field('the_geom', MULTILINESTRING(SRID), key='geom') 
    83     has_field('fnode', Integer, key='node_f_id') 
    84     has_field('tnode', Integer, key='node_t_id') 
    85     has_field('fraddl', Integer, key='addr_f_l') 
    86     has_field('toaddl', Integer, key='addr_t_l') 
    87     has_field('fraddr', Integer, key='addr_f_r') 
    88     has_field('toaddr', Integer, key='addr_t_r') 
    89     has_field('tlid', Float, key='permanent_id') 
    90     has_field('cfcc', Integer, key='code') 
    91     has_field('one_way', String(2)) 
    92     has_field('bike_facil', String(2), key='bikemode') 
     81    # TODO: Convert to SA declarative 
     82    ## To edge table (core) 
     83    #has_field('the_geom', MULTILINESTRING(SRID), key='geom') 
     84    #has_field('fnode', Integer, key='node_f_id') 
     85    #has_field('tnode', Integer, key='node_t_id') 
     86    #has_field('fraddl', Integer, key='addr_f_l') 
     87    #has_field('toaddl', Integer, key='addr_t_l') 
     88    #has_field('fraddr', Integer, key='addr_f_r') 
     89    #has_field('toaddr', Integer, key='addr_t_r') 
     90    #has_field('tlid', Float, key='permanent_id') 
     91    #has_field('cfcc', Integer, key='code') 
     92    #has_field('one_way', String(2)) 
     93    #has_field('bike_facil', String(2), key='bikemode') 
    9394 
    94     # To street names table 
    95     has_field('fedirp', String(2), key='prefix') 
    96     has_field('fename', String(30), key='name') 
    97     has_field('fetype', String(4), key='sttype') 
    98     has_field('fedirs', String(2), key='suffix') 
     95    ## To street names table 
     96    #has_field('fedirp', String(2), key='prefix') 
     97    #has_field('fename', String(30), key='name') 
     98    #has_field('fetype', String(4), key='sttype') 
     99    #has_field('fedirs', String(2), key='suffix') 
    99100 
    100     # To cities table 
    101     has_field('cityl', String(4), key='city_l') 
    102     has_field('cityr', String(4), key='city_r') 
     101    ## To cities table 
     102    #has_field('cityl', String(4), key='city_l') 
     103    #has_field('cityr', String(4), key='city_r') 
    103104 
    104     # To places table 
    105     has_field('zipl', Integer, key='zip_code_l') 
    106     has_field('zipr', Integer, key='zip_code_r') 
     105    ## To places table 
     106    #has_field('zipl', Integer, key='zip_code_l') 
     107    #has_field('zipr', Integer, key='zip_code_r') 
    107108 
    108     # To edge table (supplemental) 
    109     has_field('lanes', Integer) 
    110     has_field('adt', Integer) 
    111     has_field('spd', Integer) 
     109    ## To edge table (supplemental) 
     110    #has_field('lanes', Integer) 
     111    #has_field('adt', Integer) 
     112    #has_field('spd', Integer) 
  • Core/trunk/bycycle/core/model/milwaukeewi/data/integrator.py

    r1046 r1160  
    1212# NO WARRANTY OF ANY KIND. 
    1313############################################################################### 
    14 from byCycle.model.data import integrator 
    15 from byCycle.model import milwaukeewi 
    16 from byCycle.model.milwaukeewi import data 
     14from bycycle.core.model.data import integrator 
     15from bycycle.core.model import milwaukeewi 
     16from bycycle.core.model.milwaukeewi import data 
    1717 
    1818 
  • Core/trunk/bycycle/core/model/milwaukeewi/data/shp2sql.py

    r461 r1160  
    99TERMS AND CONDITIONS FOR USE, MODIFICATION, DISTRIBUTION 
    1010 
    11 1. The software may be used and modified by individuals for noncommercial,  
     111. The software may be used and modified by individuals for noncommercial, 
    1212private use. 
    1313 
    14142. The software may not be used for any commercial purpose. 
    1515 
    16 3. The software may not be made available as a service to the public or within  
     163. The software may not be made available as a service to the public or within 
    1717any organization. 
    1818 
    19194. The software may not be redistributed. 
    2020 
    21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND  
    22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  
    23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE  
    24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR  
    25 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES  
    26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  
    27 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON  
    28 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  
    29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  
     21THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
     22ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
     23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
     24DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
     25ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
     26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
     27LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
     28ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    3030SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    3131 
    3232""" 
    33 # shp2sql.py  
     33# shp2sql.py 
    3434#  Milwaukee, WI, shp/dbf import 
    35 #    
    36 # AUTHOR  
     35# 
     36# AUTHOR 
    3737#  Wyatt Baldwin <wyatt@bycycle.org> 
    38 # DATE  
     38# DATE 
    3939#  January 27, 2006 
    4040#  March 30, 2006 [Switched from SQLite to MySQL] 
    4141#  April 4, 2006 [Converted to single-DB, shared with other regions] 
    42 # VERSION  
     42# VERSION 
    4343#  0.1 
    44 # PURPOSE  
     44# PURPOSE 
    4545#  Script to import line geometry and associated attributes from a street layer 
    4646#  shapefile into a normalized database 
    47 # USAGE  
     47# USAGE 
    4848#  python shp2sql.py 
    49 # LICENSE  
     49# LICENSE 
    5050#  GNU Public License (GPL) 
    5151#  See LICENSE in top-level package directory 
    52 # WARRANTY  
     52# WARRANTY 
    5353#  This program comes with NO warranty, real or implied. 
    5454# TODO 
    5555#  Turn this into a derived class; create a base class that all regions can use 
    5656import sys, os 
    57 from byCycle.util import gis, meter 
     57from bycycle.core.util import gis, meter 
    5858 
    5959 
     
    120120timer = None 
    121121 
    122      
     122 
    123123def shpToRawSql(): 
    124124    datasource = 'route_roads84psrenode' 
     
    138138    if not _wait('Load SQL into DB'): 
    139139        _system(cmd) 
    140      
     140 
    141141def addColumns(): 
    142     # Add missing...     
     142    # Add missing... 
    143143    # INTEGER columns 
    144144    Q = 'ALTER TABLE %s ADD COLUMN %%s %%s NOT NULL' % raw 
     
    177177    cmd = 'mysql -u root --password="" < ./schema.sql' 
    178178    _system(cmd) 
    179              
     179 
    180180def unifyAddressRanges(): 
    181181    """Combine left and right side address number into a single value.""" 
     
    224224    for row in db.fetchAll(): 
    225225        stid = stnames[(row[1],row[2],row[3],row[4])] 
    226         if stid in stid_rawids:  
     226        if stid in stid_rawids: 
    227227            stid_rawids[stid].append(row[0]) 
    228         else:  
     228        else: 
    229229            stid_rawids[stid] = [row[0]] 
    230230    # Iterate over street name IDs and set street name IDs of raw records 
     
    279279        '(SELECT DISTINCT fnode, startpoint(geo)' \ 
    280280        ' FROM %s)' % (region, raw) 
    281     _execute(Q)     
     281    _execute(Q) 
    282282    Q = 'INSERT INTO %s_layer_node ' \ 
    283283        '(SELECT DISTINCT tnode, endpoint(geo)' \ 
     
    314314    """Set up DB connection.""" 
    315315    global db 
    316     path = 'byCycle.model.%s' % region 
     316    path = 'bycycle.core.model.%s' % region 
    317317    db = __import__(path, globals(), locals(), ['']).Mode() 
    318   
     318 
    319319def _execute(Q, show=True): 
    320320    """Execute a SQL query.""" 
     
    331331def run(): 
    332332    global start, only, no_prompt, timer 
    333      
     333 
    334334    overall_timer = meter.Timer() 
    335335    overall_timer.start() 
    336336 
    337337    # Reset for each function 
    338     timer = meter.Timer()     
     338    timer = meter.Timer() 
    339339    timer.start() 
    340340 
     
    344344             ('Add columns to raw', 
    345345              addColumns), 
    346               
     346 
    347347             ('Fix raw table: Remove NULLs, add columns, etc', 
    348348              fixRaw), 
    349               
     349 
    350350             ('Create byCycle schema tables', 
    351351              createSchema), 
    352               
     352 
    353353             ('Unify address ranges', 
    354354              unifyAddressRanges), 
    355               
     355 
    356356             ('Transfer street names', 
    357357              transferStreetNames), 
    358               
     358 
    359359             ('Update street name IDs in raw table', 
    360360              updateRawStreetNameIds), 
    361               
     361 
    362362             ('Transfer city names', 
    363363              transferCityNames), 
    364               
     364 
    365365             ('Update city IDs in raw table', 
    366366              updateRawCityIds), 
    367               
     367 
    368368             ('Update state IDs in raw table', 
    369369              updateRawStateIds), 
    370               
     370 
    371371             ('Create nodes', 
    372372              createNodes), 
    373               
     373 
    374374             ('Transfer attributes', 
    375375              transferAttrs), 
     
    381381    except IndexError: 
    382382      pass 
    383     else:  
     383    else: 
    384384        try: 
    385385            start = int(arg1) 
     
    394394                only = arg2 == 'only' 
    395395                no_prompt = arg2 == 'no_prompt' 
    396    
     396 
    397397    print 'Transferring data into byCycle schema...\n' \ 
    398398          '----------------------------------------' \ 
     
    409409        except IndexError: 
    410410            args = () 
    411         # Do function             
    412         timer.start()  
     411        # Do function 
     412        timer.start() 
    413413        apply(func, args) 
    414414        print timer.stop() 
  • Core/trunk/bycycle/core/model/portlandor/__init__.py

    r1155 r1160  
    1515from sqlalchemy.types import Unicode, Integer, String, CHAR, Integer, Numeric, Float 
    1616 
    17 from byCycle.model import db 
    18 from byCycle.model.entities import base 
    19 from byCycle.model.entities.util import encodeFloat 
    20 from byCycle.model.data.sqltypes import POINT, LINESTRING 
    21 from byCycle.model.portlandor.data import SRID, slug 
     17from bycycle.core.model import db 
     18from bycycle.core.model.entities import base 
     19from bycycle.core.model.entities.util import encodeFloat 
     20from bycycle.core.model.data.sqltypes import POINT, LINESTRING 
     21from bycycle.core.model.portlandor.data import SRID, slug 
    2222 
    2323from dijkstar import infinity 
  • Core/trunk/bycycle/core/model/portlandor/bicycle.py

    r918 r1160  
    66# Copyright (C) 2006 Wyatt Baldwin, byCycle.org <wyatt@bycycle.org>. 
    77# All rights reserved. 
    8 #  
     8# 
    99# For terms of use and warranty details, please see the LICENSE file included 
    1010# in the top level of this distribution. This software is provided AS IS with 
     
    1212############################################################################### 
    1313"""Bicycle travel mode for Portland, OR, region.""" 
    14 from byCycle.model import tmode 
    15 from byCycle.model.entities.util import float_decode 
     14from bycycle.core.model import tmode 
     15from bycycle.core.model.entities.util import float_decode 
    1616 
    1717 
     
    3333        """ 
    3434 
    35         ``pref`` `string`         
     35        ``pref`` `string` 
    3636            User's simple preference option. Can be empty or one of "default", 
    3737            "flatter", "safer", "shorter", or "faster". 
     
    4444                      (0,    0.65, 1.8, 3.7, 7,  12, 21,  500)] 
    4545        mph_up     =  (12.5, 11,   9.5, 7.5, 5,  3,  2.5, 2.5) 
    46         mph_down   =  (12.5, 14,   17,  21,  26, 31, 32,  32)         
    47          
     46        mph_down   =  (12.5, 14,   17,  21,  26, 31, 32,  32) 
     47 
    4848        global edge_attrs_index, length_index, code_index, bikemode_index 
    4949        global abs_slp_index, up_frac_index, node_f_id_index 
     
    5555        abs_slp_index = edge_attrs_index['abs_slope'] 
    5656        up_frac_index = edge_attrs_index['up_frac'] 
    57         node_f_id_index = edge_attrs_index['node_f_id']         
     57        node_f_id_index = edge_attrs_index['node_f_id'] 
    5858        street_name_id_index = edge_attrs_index['street_name_id'] 
    5959 
     
    9292            lt = 1 
    9393            mt = 1.17 
    94             ht = 1.33             
     94            ht = 1.33 
    9595            ca = 2.67 
    9696            cca = 10 
     
    102102            bca = 2 
    103103            bcca = 3 
    104             bccca = 4  
     104            bccca = 4 
    105105            # no bike mode 
    106106            mult = 2 
     
    111111            no_bm_cca = bcca * mult 
    112112            no_bm_ccca = bccca * mult 
    113   
     113 
    114114    def getEdgeWeight(self, v, edge_attrs, prev_edge_attrs): 
    115115        """Calculate weight for edge given it & last crossed edge's attrs.""" 
     
    124124 
    125125        # -- Calculate base weight of edge (in hours) 
    126          
     126 
    127127        # Length of edge that is uphill in from => to direction 
    128128        up_len = length * upfrac 
     
    179179                elif 1200 <= code < 1300:  hours *= bcca   #ca+ 
    180180                elif 1100 <= code < 1200:  hours *= bccca  #ca++ 
    181                 else:                      hours *= xxx    #?           
     181                else:                      hours *= xxx    #? 
    182182            elif bikemode == 'l':          hours *= lt 
    183183            elif bikemode == 'm':          hours *= mt 
     
    206206                hours += .0027777  # 10 seconds 
    207207        except TypeError: 
    208             pass         
     208            pass 
    209209 
    210210        return hours 
  • Core/trunk/bycycle/core/model/portlandor/data/__init__.py

    r1096 r1160  
    1616from sqlalchemy.types import Integer, String, Integer, Float, Numeric 
    1717 
    18 from byCycle.model import db 
    19 from byCycle.model.entities import DeclarativeBase 
    20 from byCycle.model.data.sqltypes import MULTILINESTRING 
     18from bycycle.core.model import db 
     19from bycycle.core.model.entities import DeclarativeBase 
     20from bycycle.core.model.data.sqltypes import MULTILINESTRING 
    2121 
    2222from cities import cities_atof 
  • Core/trunk/bycycle/core/model/portlandor/data/integrator.py

    r1046 r1160  
    1212# NO WARRANTY OF ANY KIND. 
    1313############################################################################### 
    14 from byCycle.model.data import integrator 
    15 from byCycle.model import portlandor 
    16 from byCycle.model.portlandor import data 
     14from bycycle.core.model.data import integrator 
     15from bycycle.core.model import portlandor 
     16from bycycle.core.model.portlandor import data 
    1717 
    1818 
  • Core/trunk/bycycle/core/model/regions.py

    r1034 r1160  
    1717 
    1818""" 
    19 from byCycle.model.entities import Region 
     19from bycycle.core.model.entities import Region 
    2020 
    2121 
  • Core/trunk/bycycle/core/model/route.py

    r1155 r1160  
    1515from shapely.geometry import LineString 
    1616 
    17 from byCycle.model import glineenc 
     17from bycycle.core.model import glineenc 
    1818 
    1919__all__ = ['Route'] 
  • Core/trunk/bycycle/core/model/sttypes.py

    r760 r1160  
    2222 
    2323""" 
    24 from byCycle.util import swapKeysAndValues 
     24from bycycle.core.util import swapKeysAndValues 
    2525 
    2626 
  • Core/trunk/bycycle/core/scripts/cmd.py

    r461 r1160  
    33# Created: 2006-09-26 
    44 
    5 """ 
    6 Command-line interface to the byCycle library. 
     5"""Command-line interface to the byCycle library.""" 
     6import sys 
    77 
    8 """ 
    9 import os 
    10 def __getbyCycleImportPath(level): 
    11     """Get path to dir containing the byCycle package this module is part of. 
    12      
    13     ``level`` `int` 
    14         How many levels up the dir containing the package is. 
    15          
    16     TODO: In Python 2.5 I think this just becomes  
    17           "from ...byCycle.model import <stuff>" or maybe 
    18           "from ..model import <stuff>" 
    19      
    20     """ 
    21     path = os.path.abspath(__file__) 
    22     opd = os.path.dirname 
    23     for i in range(level): 
    24         path = opd(path) 
    25     return path 
    26  
    27 import sys 
    28 sys.path.insert(0, __getbyCycleImportPath(3)) 
    29 from byCycle.model import regions 
    30 from byCycle.util import meter 
     8from bycycle.core.model import regions 
     9from bycycle.core.util import meter 
    3110 
    3211 
    33 import_path = 'byCycle.services.%s' 
     12import_path = 'bycycle.core.services.%s' 
    3413 
    3514services = { 
     
    4019 
    4120errors = [] 
    42   
     21 
    4322timer = meter.Timer() 
    4423 
    45     
     24 
    4625def main(argv): 
    4726    checkForErrors() 
     
    5231        addError('No service specified') 
    5332    else: 
    54         if service in services: 
    55             service = services[service] 
     33        service = services[service] 
     34        path = import_path % service 
    5635        try: 
    57             service_module = __import__(import_path % service, 
    58                                         globals(), locals(), ['']) 
     36            service_module = __import__(path, globals(), locals(), ['']) 
    5937        except ImportError: 
    6038            raise 
    61             addError('Unknown service "%s"' % service) 
    62          
     39 
    6340    try: 
    6441        q = argv[2] 
     
    9875        sys.exit(2) 
    9976 
    100          
     77 
    10178def usage(msgs=[]): 
    10279    print 'Usage: bycycle.py ' \ 
  • Core/trunk/bycycle/core/scripts/integrate.py

    r1057 r1160  
    2121 
    2222    shp2pgsql.py --region portlandor --source pirate --layer str06oct -n 
    23      
     23 
    2424    In this example, --region is the region "key" matching the region's 
    2525    Python module name and ``slug`` in the public.regions database table. 
    26      
     26 
    2727    --source is the name of a directory in ${HOME}/byCycleData/portlandor. In 
    2828    this case, on my machine, it refers to the directory 
    29     /home/bycycle/byCycleData/portlandor/pirate.  
    30      
     29    /home/bycycle/byCycleData/portlandor/pirate. 
     30 
    3131    [Note that, for now, ${HOME}/byCycleData can't be changed from the command 
    3232    line. It can be changed by creating an Integrator and setting its 
     
    5151        The data source. This is a directory containing shapefiles. For now, 
    5252        it is always relative to ${HOME}/byCycleData. REQUIRED. 
    53          
    54     --layer | -l <layer name>     
     53 
     54    --layer | -l <layer name> 
    5555        The data layer. This is the base name for a shapefile and its related 
    5656        files. For example, if the layer name is "str06oct", there will be 
    5757        corresponding files named "str06oct.shp", "str06oct.dbf", etc. 
    5858        REQUIRED. 
    59          
     59 
    6060    --start | -s <index> 
    6161        The index (0-based) of the action to start from. Yes, this is clunky 
    6262        in that we need to know the index number for an action--a menu system 
    6363        should be created. Defaults to 0. 
    64          
     64 
    6565    --end | -e <index> 
    6666        Like --start but for the last action that should be run. Defaults to 
    6767        one less than the number of actions. 
    68          
     68 
    6969    --no-prompt | -n 
    7070        Run the actions from --start to --end without prompting. The default 
    7171        is to prompt for every action. 
    72          
     72 
    7373    --only | -o <index> 
    74         Do just the action indicated by ``index``, without prompting. By  
     74        Do just the action indicated by ``index``, without prompting. By 
    7575        default, this isn't used. 
    76      
     76 
    7777    If no args are supplied, the default is to prompt for all actions. 
    7878 
     
    8686 
    8787 
    88 def main(argv):     
     88def main(argv): 
    8989    # Get command line options 
    9090    opts = getOpts(sys.argv[1:]) 
     
    9494    layer = opts.pop('layer') 
    9595    no_prompt = bool(opts.get('no_prompt', opts.get('only', False))) 
    96      
    97     imp_path = 'byCycle.model.%s.data.integrator' % region 
     96 
     97    imp_path = 'bycycle.core.model.%s.data.integrator' % region 
    9898    integrator_module = __import__(imp_path, locals(), globals(), ['']) 
    9999 
  • Core/trunk/bycycle/core/scripts/matrix.py

    r791 r1160  
    22"""Create adjacency matrix for region given as first arg on command line.""" 
    33import sys 
    4 from byCycle.model import Region 
     4from bycycle.core.model import Region 
    55 
    66no_region_msg = ('Specify a region name. Use "all" to create matrices for ' 
  • Core/trunk/bycycle/core/scripts/test_bycycle.py

    r187 r1160  
    99TERMS AND CONDITIONS FOR USE, MODIFICATION, DISTRIBUTION 
    1010 
    11 1. The software may be used and modified by individuals for noncommercial,  
     111. The software may be used and modified by individuals for noncommercial, 
    1212private use. 
    1313 
    14142. The software may not be used for any commercial purpose. 
    1515 
    16 3. The software may not be made available as a service to the public or within  
     163. The software may not be made available as a service to the public or within 
    1717any organization. 
    1818 
    19194. The software may not be redistributed. 
    2020 
    21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND  
    22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  
    23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE  
    24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR  
    25 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES  
    26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  
    27 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON  
    28 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  
    29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  
     21THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
     22ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
     23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
     24DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
     25ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
     26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
     27LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
     28ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    3030SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    3131 
    3232""" 
    33 import bycycle 
     33from bycycle.core.scripts import cmd 
     34 
     35 
    3436if __name__ == '__main__': 
    3537    args_list = ( 
     
    3941    for args in args_list: 
    4042        argv = [a.strip() for a in args.split(';')] 
    41         bycycle.main(argv) 
     43        cmd.main(argv) 
  • Core/trunk/bycycle/core/services/__init__.py

    r1070 r1160  
    1313################################################################################ 
    1414"""Provides a base class for the byCycle core services.""" 
    15 from byCycle.model import regions 
    16 from byCycle.model import db 
     15from bycycle.core.model import regions 
     16from bycycle.core.model import db 
    1717 
    1818 
  • Core/trunk/bycycle/core/services/geocode.py

    r1070 r1160  
    3434from sqlalchemy.orm.exc import NoResultFound 
    3535 
    36 from byCycle.model import db 
    37 from byCycle.model import StreetName, City, State, Place 
    38 from byCycle.model.address import * 
    39 from byCycle.model.geocode import * 
    40  
    41 from byCycle import services 
    42 from byCycle.services import normaddr, identify 
    43 from byCycle.services.exceptions import * 
     36from bycycle.core.model import db 
     37from bycycle.core.model import StreetName, City, State, Place 
     38from bycycle.core.model.address import * 
     39from bycycle.core.model.geocode import * 
     40 
     41from bycycle.core import services 
     42from bycycle.core.services import normaddr, identify 
     43from bycycle.core.services.exceptions import * 
    4444 
    4545 
  • Core/trunk/bycycle/core/services/identify.py

    r1070 r1160  
    2020from sqlalchemy.orm.exc import NoResultFound 
    2121 
    22 from byCycle.model import db 
    23 from byCycle.model.point import Point 
    24 from byCycle import services 
    25 from byCycle.services.exceptions import IdentifyError 
     22from bycycle.core.model import db 
     23from bycycle.core.model.point import Point 
     24from bycycle.core import services 
     25from bycycle.core.services.exceptions import IdentifyError 
    2626 
    2727 
  • Core/trunk/bycycle/core/services/normaddr.py

    r1070 r1160  
    2929""" 
    3030import re 
    31 from byCycle import services 
    32 from byCycle.services.exceptions import ByCycleError, InputError 
    33 from byCycle.model import db 
    34 from byCycle.model import address, regions, states, sttypes, compass 
    35 from byCycle.model.entities import StreetName, Place 
     31from bycycle.core import services 
     32from bycycle.core.services.exceptions import ByCycleError, InputError 
     33from bycycle.core.model import db 
     34from bycycle.core.model import address, regions, states, sttypes, compass 
     35from bycycle.core.model.entities import StreetName, Place 
    3636 
    3737 
  • Core/trunk/bycycle/core/services/route.py

    r1155 r1160  
    4747from shapely.geometry import Point, LineString 
    4848 
    49 from byCycle.util import gis 
    50  
    51 from byCycle.model.address import * 
    52 from byCycle.model.geocode import * 
    53 from byCycle.model.route import * 
    54  
    55 from byCycle import services 
    56 from byCycle.services import geocode 
    57 from byCycle.services.exceptions import ByCycleError, InputError, NotFoundError 
     49from bycycle.core.util import gis 
     50 
     51from bycycle.core.model.address import * 
     52from bycycle.core.model.geocode import * 
     53from bycycle.core.model.route import * 
     54 
     55from bycycle.core import services 
     56from bycycle.core.services import geocode 
     57from bycycle.core.services.exceptions import ByCycleError, InputError, NotFoundError 
    5858 
    5959 
     
    148148 
    149149        # Get weight function for specified travel mode 
    150         path = 'byCycle.model.%s.%s' % (self.region.slug, tmode) 
     150        path = 'bycycle.core.model.%s.%s' % (self.region.slug, tmode) 
    151151        module = __import__(path, globals(), locals(), ['']) 
    152152        mode = module.TravelMode(self.region, pref=pref) 
  • Core/trunk/tests/test_gis.py

    r855 r1160  
    99TERMS AND CONDITIONS FOR USE, MODIFICATION, DISTRIBUTION 
    1010 
    11 1. The software may be used and modified by individuals for noncommercial,  
     111. The software may be used and modified by individuals for noncommercial, 
    1212private use. 
    1313 
    14142. The software may not be used for any commercial purpose. 
    1515 
    16 3. The software may not be made available as a service to the public or within  
     163. The software may not be made available as a service to the public or within 
    1717any organization. 
    1818 
    19194. The software may not be redistributed. 
    2020 
    21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND  
    22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  
    23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE  
    24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR  
    25 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES  
    26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  
    27 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON  
    28 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  
    29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  
     21THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
     22ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
     23WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
     24DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
     25ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
     26(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
     27LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
     28ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    3030SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    3131 
    3232""" 
    3333import unittest 
    34 from byCycle.util.gis import * 
     34from bycycle.core.util.gis import * 
    3535 
    3636 
     
    3838    def testTuple(self): 
    3939        p = Point((-122.0, 45.0)) 
    40      
     40 
    4141    def testWKTGeometry(self): 
    4242        p = Point('point (1 2)') 
    43      
     43 
    4444    def testEvalAsTuple(self): 
    4545        p = Point("('-122.0', '45.0')") 
    46      
     46 
    4747    def testTupleOfStrings(self): 
    4848        p = Point(('-122.0', '45.0')) 
    49      
     49 
    5050    def testTupleOfFloats(self): 
    5151        p = Point((-122.0, 45.0)) 
    5252        p = Point((-122, 45)) 
    53      
     53 
    5454    def testClonePoint(self): 
    5555        p = Point(Point(x=123, y=45)) 
    56      
     56 
    5757    def testXYFloat(self): 
    5858        p = Point(x=-122.0, y=45.0) 
    5959        p = Point(x=-122, y=45) 
    60      
     60 
    6161    def testXYString(self): 
    6262        p = Point(x='-122', y='45') 
    63      
     63 
    6464    def testXYPreferred(self): 
    6565        p = Point(x_y='Blarg!', x=-123, y=45) 
    6666        self.assertEqual(p.x, -123) 
    6767        self.assertEqual(p.y, 45) 
    68      
     68 
    6969    def testNoArgs(self): 
    7070        p = Point() 
     
    8888        lPoints = importWktGeometry(sPoints) 
    8989        checkPoints(lPoints) 
    90          
     90 
    9191    def testImportPoint(self): 
    9292        def checkPoint(point): 
  • Core/trunk/tests/test_model/test_address.py

    r856 r1160  
    1616""" 
    1717import unittest 
    18 from byCycle.model.address import * 
    19 from byCycle.model.entities import * 
     18from bycycle.core.model.address import * 
     19from bycycle.core.model.entities import * 
    2020 
    2121 
     
    8080        sAddr = 'SE Kelly St & SE 49th Ave\nPortland, OR 97206' 
    8181        assert(str(oAddr) == sAddr) 
    82          
     82 
    8383 
    8484class TestPointAddress(unittest.TestCase): 
    8585    """Test creation of `PointAddress`es.""" 
    86      
     86 
    8787    def test_WKT(self): 
    8888        oAddr = PointAddress(x=-123.12, y=45) 
    8989        self.assertEqual(str(oAddr), 'POINT (-123.120000 45.000000)') 
    90          
     90 
    9191    def test_Eval(self): 
    9292        oAddr = PointAddress(point='(-123.12, 45)') 
     
    9494        oAddr = PointAddress(point='{"x": -123.12, "y": 45}') 
    9595        self.assertEqual(str(oAddr), 'POINT (-123.120000 45.000000)') 
    96          
     96 
    9797    def test_Kwargs(self): 
    9898        oAddr = PointAddress(point='x=-123.12, y=45') 
     
    112112    def test_Sequence(self): 
    113113        oAddr = PointAddress(point=(-123.12, 45)) 
    114         self.assertEqual(str(oAddr), 'POINT (-123.120000 45.000000)')         
    115          
    116          
     114        self.assertEqual(str(oAddr), 'POINT (-123.120000 45.000000)') 
     115 
     116 
    117117if __name__ == "__main__": 
    118118    unittest.main() 
  • Core/trunk/tests/test_services/test_geocode.py

    r1071 r1160  
    1313################################################################################ 
    1414import unittest 
    15 from byCycle.util import meter 
    16 from byCycle.model import StreetName 
    17 from byCycle.model.geocode import * 
    18 from byCycle.services.geocode import * 
     15from bycycle.core.util import meter 
     16from bycycle.core.model import StreetName 
     17from bycycle.core.model.geocode import * 
     18from bycycle.core.services.geocode import * 
    1919 
    2020 
  • Core/trunk/tests/test_services/test_normaddr.py

    r1046 r1160  
    1313################################################################################ 
    1414import unittest 
    15 from byCycle.services.normaddr import * 
    16 from byCycle.model import address, db 
    17 from byCycle.model.entities import Region, StreetName 
     15from bycycle.core.services.normaddr import * 
     16from bycycle.core.model import address, db 
     17from bycycle.core.model.entities import Region, StreetName 
    1818from sqlalchemy import * 
    1919 
  • Core/trunk/tests/test_services/test_route.py

    r1072 r1160  
    1414import unittest 
    1515 
    16 from byCycle.services.route import * 
    17 from byCycle.model.route import Route 
     16from bycycle.core.services.route import * 
     17from bycycle.core.model.route import Route 
    1818 
    1919 
  • TripPlanner/trunk/bycycle/tripplanner/__init__.py

    r222 r1160  
    1 """ 
    2 tripplanner 
    3  
    4 This file loads the finished app from tripplanner.config.middleware. 
    5  
    6 """ 
    7  
    8 from tripplanner.config.middleware import make_app 
     1from bycycle.tripplanner.config.middleware import make_app 
  • TripPlanner/trunk/bycycle/tripplanner/config/__init__.py

    r501 r1160  
    1 # 
     1 
  • TripPlanner/trunk/bycycle/tripplanner/config/environment.py

    r1035 r1160  
    55from mako.lookup import TemplateLookup 
    66 
    7 from tripplanner.config.routing import make_map 
     7from bycycle.tripplanner.config.routing import make_map 
    88 
    9 import tripplanner.lib.app_globals as app_globals 
    10 import tripplanner.lib.helpers 
    11 from tripplanner.config.routing import make_map 
     9from bycycle.tripplanner.lib.app_globals import Globals 
     10import bycycle.tripplanner.lib.helpers 
     11from bycycle.tripplanner.config.routing import make_map 
    1212 
    1313 
     
    2222 
    2323    # Initialize config with the basic options 
    24     config.init_app(global_conf, app_conf, package='tripplanner', paths=paths) 
     24    config.init_app( 
     25        global_conf, app_conf, package='bycycle.tripplanner', paths=paths) 
    2526 
    2627    # The following template options are passed to your template engines 
    2728    config['routes.map'] = make_map() 
    28     config['pylons.app_globals'] = app_globals.Globals() 
    29     config['pylons.h'] = tripplanner.lib.helpers 
     29    config['pylons.app_globals'] = Globals() 
     30    config['pylons.h'] = bycycle.tripplanner.lib.helpers 
    3031 
    3132    # Create the Mako TemplateLookup, with the default auto-escaping 
  • TripPlanner/trunk/bycycle/tripplanner/config/middleware.py

    r1132 r1160  
    1111from routes.middleware import RoutesMiddleware 
    1212 
    13 from tripplanner.config.environment import load_environment 
    14 from tripplanner.lib.middleware import RedirectMiddleware 
     13from bycycle.tripplanner.config.environment import load_environment 
     14from bycycle.tripplanner.lib.middleware import RedirectMiddleware 
    1515 
    1616 
  • TripPlanner/trunk/bycycle/tripplanner/controllers/error.py

    r1037 r1160  
    1212from webhelpers.html.builder import literal 
    1313 
    14 from tripplanner.lib.base import BaseController 
     14from bycycle.tripplanner.lib.base import BaseController 
    1515 
    1616 
  • TripPlanner/trunk/bycycle/tripplanner/controllers/geocodes.py

    r1122 r1160  
    1 from byCycle.services.geocode import Service, MultipleMatchingAddressesError 
     1from bycycle.core.services.geocode import Service, MultipleMatchingAddressesError 
    22 
    3 from tripplanner.controllers.services import * 
     3from bycycle.tripplanner.controllers.services import * 
    44 
    55 
  • TripPlanner/trunk/bycycle/tripplanner/controllers/regions.py

    r1151 r1160  
    1 from byCycle.services.exceptions import InputError, NotFoundError 
    2 from byCycle.model import regions 
    3 from byCycle.model.entities.public import Region 
     1from bycycle.core.services.exceptions import InputError, NotFoundError 
     2from bycycle.core.model import regions 
     3from bycycle.core.model.entities.public import Region 
    44 
    5 from tripplanner.lib.base import * 
     5from bycycle.tripplanner.lib.base import * 
    66 
    77 
  • TripPlanner/trunk/bycycle/tripplanner/controllers/routes.py

    r1122 r1160  
    1 from byCycle.services.exceptions import InputError 
    2 from byCycle.services.route import Service, MultipleMatchingAddressesError 
     1from bycycle.core.services.exceptions import InputError 
     2from bycycle.core.services.route import Service, MultipleMatchingAddressesError 
    33 
    4 from tripplanner.controllers.services import * 
     4from bycycle.tripplanner.controllers.services import * 
    55 
    66 
  • TripPlanner/trunk/bycycle/tripplanner/controllers/services.py

    r1142 r1160  
    55import simplejson 
    66 
    7 from byCycle.services.exceptions import * 
    8 from byCycle.model.geocode import Geocode 
    9  
    10 from tripplanner.lib.base import * 
    11 from tripplanner.lib.base import __all__ as base__all__ 
    12 from tripplanner.controllers.regions import RegionsController 
     7from bycycle.core.services.exceptions import * 
     8from bycycle.core.model.geocode import Geocode 
     9 
     10from bycycle.tripplanner.lib.base import * 
     11from bycycle.tripplanner.lib.base import __all__ as base__all__ 
     12from bycycle.tripplanner.controllers.regions import RegionsController 
    1313 
    1414__all__ = base__all__ + ['ServicesController'] 
  • TripPlanner/trunk/bycycle/tripplanner/controllers/template.py

    r501 r1160  
    1 from tripplanner.lib.base import * 
     1from bycycle.tripplanner.lib.base import * 
    22 
    33class TemplateController(BaseController): 
    44    def view(self, url): 
    55        """ 
    6         This is the last place which is tried during a request to try to find a  
     6        This is the last place which is tried during a request to try to find a 
    77        file to serve. It could be used for example to display a template:: 
    8          
     8 
    99            def view(self, url): 
    1010                return render_response(url) 
    11          
     11 
    1212        Or, if you're using Myghty and would like to catch the component not 
    1313        found error which will occur when the template doesn't exist; you 
    1414        can use the following version which will provide a 404 if the template 
    1515        doesn't exist:: 
    16          
     16 
    1717            import myghty.exception 
    18              
     18 
    1919            def view(self, url): 
    2020                try: 
     
    2222                except myghty.exception.ComponentNotFound: 
    2323                    return Response(code=404) 
    24          
     24 
    2525        The default is just to abort the request with a 404 File not found 
    2626        status message. 
  • TripPlanner/trunk/bycycle/tripplanner/lib/base.py

    r1067 r1160  
    88import restler as _restler 
    99 
    10 from byCycle import model 
     10from bycycle.core import model 
    1111 
    12 import tripplanner.lib.helpers as h 
     12import bycycle.tripplanner.lib.helpers as h 
    1313 
    1414 
  • TripPlanner/trunk/bycycle/tripplanner/tests/__init__.py

    r501 r1160  
    1 import os 
    2 import sys 
     1"""Pylons application test package 
     2 
     3This package assumes the Pylons environment is already loaded, such as 
     4when this script is imported from the `nosetests --with-pylons=test.ini` 
     5command. 
     6 
     7This module initializes the application via ``websetup`` (`paster 
     8setup-app`) and provides the base testing objects. 
     9""" 
    310from unittest import TestCase 
    411 
    5 here_dir = os.path.dirname(os.path.abspath(__file__)) 
    6 conf_dir = os.path.dirname(os.path.dirname(here_dir)) 
     12from paste.deploy import loadapp 
     13from paste.fixture import TestApp 
     14from paste.script.appinstall import SetupCommand 
    715 
    8 sys.path.insert(0, conf_dir) 
     16from pylons import config, url 
    917 
    10 import pkg_resources 
     18from routes import url_for 
     19from routes.util import URLGenerator 
    1120 
    12 pkg_resources.working_set.add_entry(conf_dir) 
     21import pylons.test 
    1322 
    14 pkg_resources.require('Paste') 
    15 pkg_resources.require('PasteScript') 
     23__all__ = ['environ', 'url', 'url_for', 'TestController'] 
    1624 
    17 from paste.deploy import loadapp, CONFIG 
    18 import paste.deploy 
    19 import paste.fixture 
    20 import paste.script.appinstall 
     25# Invoke websetup with the current config file 
     26SetupCommand('setup-app').run([config['__file__']]) 
    2127 
    22 from tripplanner.config.routing import * 
    23 from routes import request_config, url_for 
    24  
    25 test_file = os.path.join(conf_dir, 'test.ini') 
    26 conf = paste.deploy.appconfig('config:' + test_file) 
    27 CONFIG.push_process_config({'app_conf': conf.local_conf, 
    28                             'global_conf': conf.global_conf})  
    29  
    30 cmd = paste.script.appinstall.SetupCommand('setup-app') 
    31 cmd.run([test_file]) 
     28environ = {} 
    3229 
    3330class TestController(TestCase): 
    34     def __init__(self, *args): 
    35         wsgiapp = loadapp('config:test.ini', relative_to=conf_dir) 
    36         self.app = paste.fixture.TestApp(wsgiapp) 
    37         TestCase.__init__(self, *args) 
    3831 
    39 __all__ = ['url_for', 'TestController'] 
     32    def __init__(self, *args, **kwargs): 
     33        if pylons.test.pylonsapp: 
     34            wsgiapp = pylons.test.pylonsapp 
     35        else: 
     36            wsgiapp = loadapp('config:%s' % config['__file__']) 
     37        self.app = TestApp(wsgiapp) 
     38        url._push_object(URLGenerator(config['routes.map'], environ)) 
     39        TestCase.__init__(self, *args, **kwargs) 
  • TripPlanner/trunk/bycycle/tripplanner/tests/functional/test_geocodes.py

    r1067 r1160  
    11import paste.fixture 
    2 from tripplanner.tests import * 
     2from bycycle.tripplanner.tests import * 
    33 
    44class TestGeocodesController(TestController): 
  • TripPlanner/trunk/bycycle/tripplanner/tests/functional/test_regions.py

    r638 r1160  
    1 from tripplanner.tests import * 
     1from bycycle.tripplanner.tests import * 
    22 
    33class TestRegionsController(TestController): 
  • TripPlanner/trunk/bycycle/tripplanner/tests/functional/test_routes.py

    r1067 r1160  
    1 from tripplanner.tests import * 
     1from bycycle.tripplanner.tests import * 
    22 
    33class TestRouteController(TestController): 
  • TripPlanner/trunk/bycycle/tripplanner/tests/functional/test_services.py

    r1023 r1160  
    1 from tripplanner.tests import * 
     1from bycycle.tripplanner.tests import * 
    22 
    33class TestServiceController(TestController): 
  • TripPlanner/trunk/bycycle/tripplanner/websetup.py

    r617 r1160  
    11import paste.deploy 
    2 from byCycle import model 
     2from bycycle.core import model 
    33 
    44 
  • TripPlanner/trunk/development.ini

    r1065 r1160  
    4646level = DEBUG 
    4747handlers = 
    48 qualname = acehotel 
     48qualname = tripplanner 
    4949 
    5050[logger_sqlalchemy] 
  • TripPlanner/trunk/setup.cfg

    r502 r1160  
    33tag_svn_revision = true 
    44 
    5 #[easy_install] 
    6 #find_links = http://www.pylonshq.com/download/ 
     5[easy_install] 
     6find_links = http://www.pylonshq.com/download/ 
    77 
    8 [pudge] 
    9 theme = pythonpaste.org 
    10  
    11 # Add extra doc files here with spaces between them 
    12 docs = tripplanner/docs/index.txt  
    13  
    14 # Doc Settings 
    15 doc_base = tripplanner/docs/ 
    16 dest = tripplanner/docs/html 
    17  
    18 # Add extra modules here separated with commas 
    19 modules = tripplanner 
    20 title = byCycleTripPlanner 
    21 organization = byCycle.org 
    22  
    23 # Optionally add extra links 
    24 organization_url = http://byCycle.org/ 
    25 trac_url=http://trac.bycycle.org/ 
    26 settings = no_about=true 
    27   
    28 [publish] 
    29 doc-dir=tripplanner/docs/html 
    30 make-dirs=1 
     8[nosetests] 
     9with-pylons = test.ini 
     10with-doctest = true 
  • TripPlanner/trunk/setup.py

    r1155 r1160  
    5151    ), 
    5252    test_suite = 'nose.collector', 
    53     package_data={'tripplanner': ['i18n/*/LC_MESSAGES/*.mo']}, 
     53    package_data={'bycycle.tripplanner': ['i18n/*/LC_MESSAGES/*.mo']}, 
    5454    entry_points=""" 
    5555    [paste.app_factory] 
    56     main=tripplanner:make_app 
     56    main=bycycle.tripplanner:make_app 
    5757 
    5858    [paste.app_install]