Raw MySQL with SQLAlchemy using Pyramid framework

2011-02-19 Thread AwaisMuzaffar
Hello guys, I have recently made a decision to start using the Pyramid (python web framework) for my projects from now on. I have also decided to use SQLalchemy, and I want to use raw MySQL (personal reasons) but still keep the ORM features. The first part of the code in models.py reads: DBSess

Re: Raw MySQL with SQLAlchemy using Pyramid framework

2011-02-20 Thread AwaisMuzaffar
Thanks for the reply guys it has been very informative. My main reason for using raw is that I have spent so much time learning MySQL, to me it seems counter productive to learn SQLALchemy methodologies from scratch. Ok, so maybe manually executing CREATE is not a great idea, but what about perfo

Error when trying to enable Mako

2011-02-20 Thread AwaisMuzaffar
When trying to use Mako with the Pyramid framework, by going into the development.ini file, and adding the line mako.directories = testProject:templates in: [app:testProject] and then creating a simple html file called template.mako in the templates subdirectory I get an: ImportError: No modul

varying template name which matches route path

2011-02-24 Thread AwaisMuzaffar
Lets assume, I have the following route set up: config.add_route('pages', '/{page}/', view='testproject:views.pages', view_renderer='testproject:templates/page.mak') Would it be possible to make the template name e.g page.mak a variable that matches the name of the response path. something like

Re: varying template name which matches route path

2011-02-25 Thread AwaisMuzaffar
for each page would be rather tedious wouldn't it? On Feb 24, 8:36 pm, Chris McDonough wrote: > On Thu, 2011-02-24 at 12:13 -0800, AwaisMuzaffar wrote: > > Lets assume, I have the following route set up: > > > config.add_route('pages', '/{page}/', view=&

Re: varying template name which matches route path

2011-02-26 Thread AwaisMuzaffar
. > > On Feb 24, 3:13 pm, AwaisMuzaffar wrote: > > > Lets assume, I have the following route set up: > > > config.add_route('pages', '/{page}/', view='testproject:views.pages', > > view_renderer='testproject:templates/page.mak&#

Help with creating view functions

2011-03-12 Thread AwaisMuzaffar
Hi Guys, I have the following code for the view: def pages_view(request): path = request.path.split('/')[1] dbsession = DBSession() page = dbsession.query(PagesTable).from_statement( 'SELECT * FROM pages WHERE path=:page_path').params(page_path=path).first() pages_dir = os

Invoking views

2011-03-14 Thread AwaisMuzaffar
I have the following view: def view1(request): varOne = 'test string' return render_to_response('page.mak', {'varOne':varOne}, request=request) Which gets invoked with: config.add_route('page', '/mypage/', view='myproject.views.view1') Next, I have another view: def view2(request)

Re: Invoking views

2011-03-14 Thread AwaisMuzaffar
Just to add: config.add_view('myproject.views.view2', route_name='page') results in a conflict error. (I've done some reading about this in the documentation) config.add_view('myproject.views.view2', route_name='page') On Mar 14, 10:05 pm,

Re: Invoking views

2011-03-14 Thread AwaisMuzaffar
ll be greatly appreciated. Kind Regards, Awais M. On Mar 14, 11:03 pm, AwaisMuzaffar wrote: > Just to add: >     config.add_view('myproject.views.view2', route_name='page') > results in a conflict error. (I've done some reading about this in the > documentatio

Help with extending pyramid application - issue with SQLalchemy

2011-09-10 Thread AwaisMuzaffar
Hi, I have a "Main Application", and in this application I have the following in the _init_.py file: def main(global_config, **settings): # various config settings config.include(site_configs) def site_configs(config): config.add_route('portfolio', '/portfolio', view='mainapp.vie