Re: 3rd party client applications accessing pylons model over a local network

2009-09-11 Thread Jules Stevenson
 What do you mean when you say importing a slightly modifed model on each
 client machine? How different is it and why?


I had to change the binding in the model file, so originally it read:

Session = scoped_session(sessionmaker(autoflush=True, transactional=True,

bind=config['pylons.app_globals'].sa_engine))

Now it reads:

engine = create_engine('sqlite:///C:/ark/data/project.db')

Session = scoped_session(sessionmaker(autoflush=True, transactional=True,
  bind=engine))

(I'm testing the database on a local drive atm).

I'll look into using MySQL, the idea of transferring db's terrifies me
somewhat, but I'm sure I'll get there :).

Jules

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: 3rd party client applications accessing pylons model over a local network

2009-09-11 Thread Jules Stevenson
The main differences I've seen with MySQL compared to SQLite off the
 top of my head are:
 - Rigid column lengths (SQLite stores long values; MySQL truncates
 them with a warning)
 - Different date handling functions (you'll need if-blocks in your
 code; e.g., if engine.name==mysql)
 - Different autoincrement policy (not really an issue)
 - String comparisons are case insensitive (though I think SQLite's
 LIKE is case-insensitive)


Thanks Mike, much appreciated. I've found the rigid column lengths one, but
so far so good the models been recreated in MySQL with a few minor tweaks,
and I've been able to import the dumped data from SQlite, so wasn't as
painful as I was expecting. Thanks very much for yours and everyone else's
input

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: 3rd party client applications accessing pylons model over a local network

2009-09-10 Thread Jules Stevenson
 Is there some reason you can't connect to the database remotely?
 That's the most efficient way.

Hi Mike,

Yes, I've kind of found that trying to do stuff through JSON is not really
going to hack it. As it's an Intranet I'm currently installing sqlalchemy
and importing a slightly modifed model on each client machine and connecting
directly to the DB over the local network (it's an SQlite db) by changing
the bind to create_engine. However (and this may be wrong / a stupid
question) does doing it this way have issues with concurrent access to the
DB? I.e is it pylons / paste server that keeps everything thread safe, or
sql alchemy [and therefore ok to do this]? Apologies if I've used the wrong
terminology, learning as I go :).

Jules

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Adjacency list problem [sqlachemy]

2009-08-13 Thread Jules Stevenson

Will do, thanks.

On Thu, Aug 13, 2009 at 2:00 AM, Chris Miles miles.ch...@gmail.com wrote:

 I recommend asking on the SQLALchemy list. There'll be a much greater
 expertise available there to help you out.

 Cheers
 Chris


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Time out beaker session?

2009-02-06 Thread Jules Stevenson

Hi All,

Is it possible to make the beaker session time out / delete itself after a
period of inactivity? I'd like it so that when a user doesn't use the site
for x amount of time the session is deleted, forcing the user to re log in
[user name is stored in the session].

Many thanks, Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



waitfor it and pylons debugger, WAS: Running a program without waiting for it to finish

2009-01-07 Thread Jules Stevenson

Hi Ian,

 I didn't notice this thread first time around, but you might find
 WaitForIt (http://pythonpaste.org/waitforit/) helpful for cases like
 these; you could write the code as blocking and let WaitForIt deal with
 the long-running aspect.  (Assuming it runs for a long time, but
 eventually finishes -- if you need to interact with it over time you
 should stuff the process object in a module global)

Thanks, this does indeed look like just the ticket. However I'm struggling
to get this to work with Pylons correctly, specifically it seems to
interfere with the debugger in the way that I have it set up [which is
probably wrong].

To set it up I came across a post
(http://www.mail-archive.com/paste-us...@pythonpaste.org/msg00213.html) on
the paste mailing list which contained the following info:

---
so then I tried to
use waitforit with pylons, so I made a new pylons app and added this to
my test.ini file:

[app:main]
use = config:development.ini
filter-with = slow

[filter:slow]
use=egg:waitforit
time_limit=2
poll_time=1
---

I don't think I even use test.ini, so I modded my development.ini file to
look like this:

snip

[app:main]
use = egg:ark
full_stack = true
cache_dir = %(here)s/data
beaker.session.key = ark
beaker.session.secret = somesecret
sqlalchemy.default.url = sqlite:///%(here)s/data/project.db
*filter-with = slow

*[filter:slow]
*use=egg:waitforit
*time_limit=2
*poll_time=1

/snip

With the * lines being the new additions [minus the asterisk of course].
This does work, and I can use the wait for it message etc, however if the
pylons debugger needs to kick in it's now broken, with the following errors:

Traceback (most recent call last):
  File
c:\python26\lib\site-packages\paste-1.7.2-py2.6.egg\paste\evalexception\mid
dleware.py, line 82, in simplecatcher_app
return application(environ, start_response)
  File
c:\python26\lib\site-packages\paste-1.7.2-py2.6.egg\paste\httpexceptions.py
, line 636, in __call__
return self.application(environ, start_response)
  File
c:\python26\lib\site-packages\paste-1.7.2-py2.6.egg\paste\evalexception\mid
dleware.py, line 117, in application
res = func(*args, **form.mixed())
  File
c:\python26\lib\site-packages\paste-1.7.2-py2.6.egg\paste\evalexception\mid
dleware.py, line 140, in debug_info_replacement
debugcount = int(debugcount)
TypeError: int() argument must be a string or a number, not 'list'

Any help on how to stop this?

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: Running a program without waiting for it to finish

2009-01-02 Thread Jules Stevenson

 I need my app to be able to compile and run a performance test. then
 gather the results and display the results in a relevant way. the
 tests are written in autoHotKey which is a windows scripting program.
 so to run a test all i need to do is call the file from the command
 line.

snip

This does start the test running, but the page does not finish loading
until the tests have finished.
the tests themselves can call back to the pylons app to record cpu and
memory metrics.
I guess there must be a NO_WAIT flag or something i can put in to achieve
my goal.

This page (http://docs.python.org/library/subprocess.html) suggests pid =
Popen([/bin/mycmd, myarg]).pid

Hey Toby [or anyone else], did you ever get anywhere with this? We're in a
similar situation where we have an intranet app that needs to fire off an
external app, collect some information and deliver the info back to the
user. Does anyone have any simple pointers for how to start this as a
separate process but retain some communication with pylons? For example,
having a page update based on the status of the requested action etc? Can
you repeatedly call a controller somehow [so it can check how things are
going and update the page accordingly].

Any help appreciated.

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: Problem with pylons install on win XP 32

2008-12-19 Thread Jules Stevenson


 
 You should work with Python 2.5, or maybe you could use 0.9.7rc

Not really an option, we're tied into 2.6 [64 bit windows - nice :P] because
that's the version the 3d app we use predominantly here uses.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: Problem with pylons install on win XP 32

2008-12-18 Thread Jules Stevenson

 Hi All,
 
 I've been trying to get pylons up and running on a win 32bit XP box
 under
 python 2.6.1. Easy install worked up until the json errors, I then
 manually
 installed the rest of the dependancies. JSON I ran without speedups,
 and
 therefore bypassed the failure to install.

snip

It was down to using the recommended paste dependencies, updated to newer
versions and all is well.

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Problem with pylons install on win XP 32

2008-12-17 Thread Jules Stevenson

Hi All,

I've been trying to get pylons up and running on a win 32bit XP box under
python 2.6.1. Easy install worked up until the json errors, I then manually
installed the rest of the dependancies. JSON I ran without speedups, and
therefore bypassed the failure to install.

When I try and setup a project paster dies on me with the following
traceback:

C:\paster create -t pylons ark
Traceback (most recent call last):
  File c:\python26\scripts\paster-script.py, line 8, in module
load_entry_point('pastescript==1.3.6', 'console_scripts', 'paster')()
  File
c:\python26\lib\site-packages\pastescript-1.3.6-py2.6.egg\paste\script\comm
and.py, line 77, in run
command = commands[command_name].load()
  File build\bdist.win32\egg\pkg_resources.py, line 1913, in load
  File
c:\python26\lib\site-packages\pastescript-1.3.6-py2.6.egg\paste\script\crea
te_distro.py, line 8, in module
import copydir
  File
c:\python26\lib\site-packages\pastescript-1.3.6-py2.6.egg\paste\script\copy
dir.py, line 384, in module
class LaxTemplate(string.Template):
  File C:\Python26\lib\string.py, line 119, in __init__
cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE)
  File C:\Python26\lib\re.py, line 188, in compile
return _compile(pattern, flags)
  File C:\Python26\lib\re.py, line 236, in _compile
raise ValueError('Cannot process flags argument with a compiled
pattern')
ValueError: Cannot process flags argument with a compiled pattern

Any pointers into why this is occurring would be much appreciated.

Jules




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



[no subject]

2008-12-04 Thread Jules Stevenson


Hi All, I'm building an intranet based office management 'thing'. It has a
lot to do with automating project setup, folder creation, various start up
scripts etc. One snag that I've hit is I seem unable to access mako template
files that are outside of the pylons project. 

For example

% 
path=os.path.join(g.work_path, c.shotOb.project.client.client,
c.shotOb.project.name, '_ark','utils.mako')
shot_spec_utils = local.get_namespace(path) %

Results in:

class 'mako.exceptions.TemplateLookupException': Cant locate template for
uri '//jules-pc/work_temp\client\project\_ark\utils.mako

Which as a path is correct. I'm guessing it doesn't work because it's trying
to find the path from within the templates folders of the pylons project,
for example, changing path to 'path='/clients/client.mako' [which is inside
the templates folder] is fine - is there any way to make mako understand an
'absolute' path?

I'm trying to do this as each project is likely to have its own set of
specific pages, and It makes a lot of sense to be able to tie these pages in
with the on disk file structure of the project [which is outside of the
pylons project, and certainly doesn't want to be inside the templates folder
of the pylons app :)]. If anyone has any alternative ideas for this, I'd be
well up for hearing them.

Many thanks,

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Forcing mako to access templates outside of the pylon app?

2008-12-04 Thread Jules Stevenson

apologies for the repost, accidentally omitted a subject line previously

Hi All, I'm building an intranet based office management 'thing'. It has a
lot to do with automating project setup, folder creation, various start up
scripts etc. One snag that I've hit is I seem unable to access mako template
files that are outside of the pylons project. 

For example

% 
path=os.path.join(g.work_path, c.shotOb.project.client.client,
c.shotOb.project.name, '_ark','utils.mako')
shot_spec_utils = local.get_namespace(path) %

Results in:

class 'mako.exceptions.TemplateLookupException': Cant locate template for
uri '//jules-pc/work_temp\client\project\_ark\utils.mako

Which as a path is correct. I'm guessing it doesn't work because it's trying
to find the path from within the templates folders of the pylons project,
for example, changing path to 'path='/clients/client.mako' [which is inside
the templates folder] is fine - is there any way to make mako understand an
'absolute' path?

I'm trying to do this as each project is likely to have its own set of
specific pages, and It makes a lot of sense to be able to tie these pages in
with the on disk file structure of the project [which is outside of the
pylons project, and certainly doesn't want to be inside the templates folder
of the pylons app :)]. If anyone has any alternative ideas for this, I'd be
well up for hearing them.

Many thanks,

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: newb: Correct way to set a SQLalchemy 'relation'

2008-11-20 Thread Jules Stevenson

Hi Dalius,

Thanks for getting back to me.

 Never seen it done this way. Even if it works it does not look correct
 way. It looks hard to understand and in some sense it is unpythonic -
 other developers will have hard time to understand it. Just look at
 pylons tutorials how it is done.

I have checked the docs, and I can't find a specific example where a controller 
is explicitly trying to set a class attribute that is a foreign key:

mapper(ArkClient, clients_table, properties={
'contacts':relation(ArkContact, backref='client', cascade=all, delete),
'projects':relation(ArkProject, backref=backref('client'), cascade=all, 
delete, delete-orphan)
})

Ie. Setting ArkClient.contacts or ArkCLient.projects

As before, currently doing the following:

contact.client=Session.query(ArkClient).filter(ArkClient.client=='clientName').first()

The 'clientName' string is passed through via request.POST. If anyone has links 
to examples of how this is done better that would be much appreciated.

Many thanks,

Jules




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: newb: Correct way to set a SQLalchemy 'relation'

2008-11-20 Thread Jules Stevenson

Hey Dalius,

 contact.client=Session.query(ArkClient).filter(ArkClient.client=='clien
 tName').first()
 
 I'd expect something like:
 contact.client=Session.query(ArkClient).filter(ArkClient.client.name=='
 clientName').first()
 
 I just find it very strange how you use SQLAlchemy: Table, class and
 mapper mixed into one class (ArkContact). While ArkClient mapper seems
 to be correct. As well it looks very strange that ArkClient has
 backref and you define client in ArkContact again and in addition with
 backref. It is enough to define this relation in one mapper.

Yes, apologies - I've changed from declarative to the more 'traditional' 
[separate table / class / mapper] route since my first post, I should have 
clarified that. 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: Pylons and Python 2.6 (Was: Re: go-pylons.py broken on Python 2.6 in Windows?)

2008-11-19 Thread Jules Stevenson

I'm running Pylons 9.6 under vista 64bit on Python 2.6 64bit. To say it has
been a mission to get it working is somewhat of an understatement.

Setuptools / easy install is broken under 64bit windows - the exe files it
ships with are 32bit and therefore spit blood when trying to execute [i.e.
easy_install.exe does not work]. In the end I hacked dist_utils [as this
wasn't finding the correct compiler] and relied on this and manually
building and installing from source, pylons and it's dependencies.

Next problem was that paste.exe suffers from the same problems, I'm having
to directly run paster_script.py which functions in exactly the same way
[same commands and switches etc].


 -Original Message-
 From: pylons-discuss@googlegroups.com [mailto:pylons-
 [EMAIL PROTECTED] On Behalf Of Eric Ongerth
 Sent: 18 November 2008 07:35
 To: pylons-discuss
 Subject: Re: Pylons and Python 2.6 (Was: Re: go-pylons.py broken on
 Python 2.6 in Windows?)
 
 
 Correction: the point at which easy_installing Pylons errored out was
 during the installation of simpleJSON.  So it never reached the point
 of installing paste, pastescript, pastedeploy etc.
 
 Hey, I thought Python 2.6 includes the former simpleJSON as the new
 json module.  No?
 
 
 On Nov 17, 10:31 pm, Eric Ongerth [EMAIL PROTECTED] wrote:
  Neither Pylons nor Paste install correctly at this time on the Win32
  platform using easy_install, whether in a virtualenv or even in a
  system-wide install to a clean system.  Just about everything goes
  fine until somewhere in the installation of Paste, where an error
  described only as None occurs.
 
  I was unable to find any path to obtaining a working Pylons install
 on
  Win32 under Python 2.6. (other than, of course, ditching Windows!)
  easy_install just does not install Paste correctly under 2.6, whether
  by itself or in Pylons.
 
  In another discussion somewhere I saw a thread where someone told Ian
  that even virtualenv 1.3 (reported on the virtualenv page to be 2.6-
  compatible) was not in fact working under 2.6 on Win32.  Ian replied
  that virtualenv trunk should work.  This gave me hope, but it still
  fell short.  The one thing I forgot to try was Paste trunk.  For now
 I
  think I'll leave the trunks on the train and stick with Python 2.5.2.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Purge/empty request.get?

2008-11-13 Thread Jules Stevenson

Hi,

Is there a simple way to remove the request.get variables?

I have a page that uses .GET to store a load of form elements data as the
page can be resent to the controller at any time [onchange event on a
select] but is not actually stored at this time, and these get vars are used
to repopulate the page. However I'd very much like for them to not be in the
url after the page is loaded. The Get vars are all put into a c variable
when the controller is recalled -  it would be cool to purge / empty .GET so
that when the render command returns the URL is nice and tidy again.

Any ideas much appreciated.

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Pylons docs are down

2008-11-11 Thread Jules Stevenson

The docs section on the pylons site is not working.

Cheers,

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



newb: Correct way to set a SQLalchemy 'relation'

2008-11-10 Thread Jules Stevenson

Hi List,

I'm stumbling slightly blind and just wanted to check if there is a smarter
way of doing what I'm doing. I'm using declarative classes to make the DB,
and example class below:

class ArkContact(Base):

all contacts

__tablename__ = 'contacts'

id = Column(Integer, primary_key=True)
project_id = Column(Integer, ForeignKey('projects.id'))
client_id = Column(Integer, ForeignKey('clients.id'))
firstname = Column(String)
lastname = Column(String)
email1 = Column(String)
email2 = Column(String)
workphone = Column(Integer)
mobile = Column(Integer)
project = relation(ArkProject, backref=backref('contacts',
order_by=func.lower(firstname)), cascade='all, delete')
client = relation(ArkClient, backref=backref('contacts',
order_by=func.lower(firstname)), cascade='all, delete')

def __init__(self):
self.firstname = ''
self.lastname = ''
self.email1 = ''
self.email2 = ''
self.workphone = ''
self.mobile = ''

In one of my controllers, I've created an ArkContact as above, and need to
set the 'client' and 'project' attributes. Currently I'm doing it like this:

contact=ArkContact()
contact.client=Session.query(ArkClient).filter(ArkClient.client=='clientName
').first()
Session.add(contact)
Session.commit()

This does seem to work, but I just wanted to know if this is the 'correct'
way of doing things, it seems a little strange to me.

Many thanks for any assistance.

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



newbie: Passing c values through a re_direct?

2008-10-27 Thread Jules Stevenson

Hi List,

I'm very green to pretty much everything web framework related, so apologies
in advance...

Basically my problem is that I want to be able to access 'c' object values
after a 'redirect_to' call. I'm guessing from tests that I've done that this
isn't possible. 

The idea behind this is I have a page with a load of tools at the bottom -
when a user activates a tool the form submit controller does what it needs
to and then assigns a couple of values to c [c.statusText  c.statusCSS], it
then calls a redirect to the main page controller and these values are
*supposed* to give the user a text update based o nthe result of the form.
Obviously this fails because the c settings are lost through the redirect.

My controller code looks like this:

import logging

from pylonserve.lib.base import *
from pylonserve.model import *
log = logging.getLogger(__name__)


class CtrlProjectsController(BaseController):
 
def projectMenu(self):
c.clients = Session.query(ArkClient)
return render('/projectMenu.mako')
c.statusTemp = c.status

def formProjectAdd(self):
fData=request.params['projectName']
query=Session.query(ArkClient).filter(ArkClient.client.in_(fData))
if not query.first(): 
formClient=ArkClient(fData)
Session.add(formClient)
Session.commit()
c.status='Client Added'
c.ststusCSS='normal'
else:
c.status='Client allready exists. Not added'
c.statusCSS='error'
redirect_to(action='projectMenu')

I guess my question would be what's the simplest way to get a single page
with a load of forms on it to 'refresh' with updated info?

Many thanks for any info,

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: newbie: Passing c values through a re_direct?

2008-10-27 Thread Jules Stevenson

 If you just want to show a message on the destination page,
 webhelpers.pylonslib.Flash will do that.
 
 If you need something more elaborate, you'll have to pass the data as
 query parameters, cookies, or save it in the session (the
 pylons.session, not the SQLAlchemy Session).  Saving it in the session
 is the most convenient, and is how Flash works.
 
 If you're trying to redisplay a form you can do something with
 @validate, htmlfill, and/or calling an alternate action method.
 
Thanks Mike. Amazingly fast reply!

I found a link to this on the list as well, which was very useful:

http://groups.google.com/group/pylons-discuss/browse_thread/thread/a15de8d2d
69494d1/753240b52d254eda?lnk=gstq=c+object+redirect#753240b52d254eda

Jules


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: newbie: Passing c values through a re_direct?

2008-10-27 Thread Jules Stevenson

  Saving it in the session
 is the most convenient, and is how Flash works.

I'm not sure what I'm doing, but the session object dosen't seem to be
holding any values, this is how I'm trying to manipulate the session object:

def formProjectAdd(self):
#
# validate!!
#
fData=request.params['projectName']
if fData !='':
query=Session.query(ArkClient).filter(ArkClient.client==fData)
if len(query.all())=0: 
formClient=ArkClient(fData)
Session.add(formClient)
Session.commit()
session['status']='Client Added'
session['statusCSS']='normal'
else:
session['status']='Client allready exists. Not added'
session['statusCSS']='error'
else:
session['status']='No text entered'
session['statusCSS']='error'
redirect_to('projectMenu')

When I check though a debug, the session keys have been set and are there...
session.keys():

['status', 'statusCSS', '_accessed_time', 'name', '_creation_time']

The mako files starts with this..

html
head
  titleArkMain/title
  ${h.rails.stylesheet_link_tag('/css/main.css')}
  ## ${h.rails.javascript_include_tag('/javascripts/effects.js',
builtins=True)}
/head
  
!-- left nav --
div id=left nav class=leftNav
${session.keys()}

And prints out: 

['_accessed_time', 'name', '_creation_time']

Any help much appreciated.

Jules



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---