xmlhttprequest + json + pylons

2007-11-06 Thread Alagu Madhu

Hi




JSONRequest = {
post: function( url, data, callback, timeout ) {
xhr = new XMLHttpRequest();
xhr.open(POST, url, true);
xhr.setRequestHeader( Content-Type, application/x-www-form-
urlencoded );
if (callback) {
xhr.onreadystatechange = function() {
if( xhr.readyState==4 ) {
//alert( xhr.responseText );
callback( xhr.responseText );
}
}
}
if ( data ) {
xhr.send( data );
} else {
xhr.send( null );
}
},
get: function(url, callback) {
alert( 'in JSONRequest.get();' );
}
};



using above code(js) I send the
data(login={username:python,password:pylons) to pylons.



... pylons controller...

print request.params.keys()
print request.params.items()
print request.params.values()


I am getting flowing output...


['login']
[('login', u'{username:python, password:
[u'{username:python, password:pylons}']


How can I get the username  password value ?




Thanks

Madhu Alagu


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



WSGIController.__call__ and error handling

2007-11-06 Thread Max Ischenko
Hello,

I want to write a generic error handler which will display meaningful page
to the user in case some particular error occurs.

I have tried to override WSGIController.__call__ using the following code
but it doesn't work:

try:
return WSGIController.__call__(self, environ, start_response)
except model.SQLError, e:
c.message = e
c.code = 500
return render('/custom_error.html')

When executed it simply prints a traceback to stderr:

  File 
/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/httpserver.py,
line 287, in wsgi_execute
self.wsgi_start_response)
  File 
/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/translogger.py,
line 67, in __call__
return self.application(environ, replacement_start_response)
  File 
/usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/debug/prints.py,
line 98, in __call__
environ, self.app)
  File /usr/lib/python2.5/site-packages/Paste-1.4-py2.5.egg/paste/wsgilib.py,
line 540, in intercept_output
if data[0] is None:
IndexError: list index out of range

How do I do this properly?

-- 
Max Ischenko
http://www.developers.org.ua/ -- Ukrainian software developers community
http://maxischenko.in.ua/ -- my blog (Russian)

--~--~-~--~~~---~--~~
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: Having pylons.render() to return Unicode

2007-11-06 Thread Yannick Gingras

Philip Jenvey [EMAIL PROTECTED] writes:

 Most if not all Buffet plugins (I'm not sure about Genshi or breve's)  
 are pretty much hardcoded to only return raw strings. Unfortunately  
 this is just how it's always been done with Buffet.

I had APIs developed by people who never use Unicode.  It would have
been just at easy to return Unicode.  Ok, I'll do the re-decoding by
hand.

-- 
Yannick Gingras

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



AutoConnectHub and doInTransaction bug

2007-11-06 Thread programmer.py

I know that pylons.database is about to be deprecated, but I've run
across a bug (Im using 0.9.6.1).  I'm posting this as a heads up for
anyone else that may run into this.  (I've also posted something in
the pylons trac http://pylonshq.com/project/pylonshq/ticket/327)

If you:
1)  use the AutoConnectHub in pylons.database
2)  use AutoConnectHub's inherited `doInTransaction` method
3)  do not set processConnection on the AutoConnectHub instance
4)  do not `connect` to the database via getConnection

then, doInTransaction will blow up.  doInTransaction blows up, looking
for a threadingLocal.connection, which does not exist yet because
getConnection has not been called on the hub.

The code below illustrates this.  (Change pathing of the database_uri
variable!)  First, run the code with --create-table as the command
line argument.  That creates the table.

Next, run the script again with the --do-in-transaction command line
argument.  This should blow up.

## BEGIN TEST CODE
from pylons.database import AutoConnectHub
import sys
import sqlobject

# Setup the database connection.
database_uri = 'sqlite:/c|/tmp/sqlite.dat'
__connection__ = AutoConnectHub(database_uri)

class User(sqlobject.SQLObject):
name = sqlobject.StringCol()

def main():
if '--create-table' in sys.argv:
User.createTable()
return 0
if '--do-in-transaction' in sys.argv:
print __connection__.doInTransaction(func_for_xaction)
return 0
return 0

def func_for_xaction():
print User(name = 'func for xaction')

if __name__ == __main__:
sys.exit(main())

## END TEST CODE

The quick fix for me was to derive from AutoConnectHub (well, really
PackageHub for me) and override doInTransaction -

class MyAutoConnectHub(AutoConnectHub):

def doInTransaction(self, func, *args, **kw):
if not hasattr(self.threadingLocal, connection):
self.getConnection()
return AutoConnectHub.doInTransaction(self, func, *args, **kw)

Hope this helps someone...
jw


--~--~-~--~~~---~--~~
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: About paste traceback emails

2007-11-06 Thread Ian Bicking

Yannick Gingras wrote:
 
 I have two questions regarding the backtrace emails that paste sends:
 
 1) how do you disable them?

Don't set the email address in your configuration.

 2) how do you send them without unwinding the stack?

You have to hook into what errormiddleware calls, 
paste.exceptions.errormiddleware.handle_exception.  It would be nice if 
there was something in the environment that was hooked into the 
configuration, but there isn't now, so you'll have to provide all the 
many arguments to that function.

-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Classic URL Style

2007-11-06 Thread Humberto Diógenes

Hi!

  I'm trying to port an existing mod_python app to Pylons, but had
some trouble with Routes. I'd like to keep using URLs the same
classic URL style:
  http://localhost/location/edit?location_id=123

  And then have Pylons receive it as arguments for the controller
method:

code
class LocationController(BaseController):
def edit(self, location_id):
return 'Editing %s' % location_id
/code

  But I'm getting this exception:
  TypeError: edit() takes exactly 2 arguments (1 given)

  Do you have any directions on what do I need to do to make it work?

--
Humberto Diógenes


--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Alberto Valverde

Humberto Diógenes wrote:
 Hi!
 
   I'm trying to port an existing mod_python app to Pylons, but had
 some trouble with Routes. I'd like to keep using URLs the same
 classic URL style:
   http://localhost/location/edit?location_id=123
 
   And then have Pylons receive it as arguments for the controller
 method:
 
 code
 class LocationController(BaseController):
 def edit(self, location_id):
 return 'Editing %s' % location_id
 /code
 
   But I'm getting this exception:
   TypeError: edit() takes exactly 2 arguments (1 given)
 
   Do you have any directions on what do I need to do to make it work?

Yes, pull location_id from the request GET parameters:

employment_id = request.GET.get('employment_id')

Alberto

--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Humberto Diógenes



On Nov 6, 5:56 pm, Jonathan LaCour [EMAIL PROTECTED]
wrote:

 This past weekend, I participated in a sprint on Pylons where
 we implemented two new controllers: DecoratedController and
 ObjectDispatchController.  Both of these controllers perform parameter
 injection.  Here is an example of a DecoratedController:

  from pylons.controllers import DecoratedController
  from pylons.decorators import expose

  class TestController(DecoratedController):

  @expose()
  def testing(self, name):
  return 'Hello, %s' % name

 This is all very new, so it probably has some bugs, but please do give
 it a try, and we'll do our best to fix any bugs you find!



That's great! :)

I pulled the latest version from the repository but couldn't use it.


### Existing project:

URL: http://localhost:5000/location/index
File '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/error.py',
line 245 in respond
  app_iter = self.application(environ, detect_start_response)
File '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/wsgiapp.py',
line 95 in __call__
  controller = self.resolve(environ, start_response)
File '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/wsgiapp.py',
line 173 in resolve
  match = environ['wsgiorg.routing_args'][1]
KeyError: 'wsgiorg.routing_args'



### New project:

$ paster create -t pylons PylonsTest2
[...]
OSError: [Errno 2] No such file or directory: '/Library/Frameworks/
Python.framework/Versions/2.4/lib/python2.4/site-packages/
Pylons-0.9.7dev_20071106-py2.4.egg/pylons/templates/default_project'

$ ls -l /Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/
templates/
-rwxr-xr-x   1 root  admin0 Nov  6 19:02 __init__.py
-rwxr-xr-x   1 root  admin  221 Nov  6 19:02 __init__.pyc


  I hope I'm not doing anything wrong. :P

--
Humberto Diógenes
http://humberto.digi.com.br



--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Jose Galvez

Thanks for the correction Mike
Jose

Mike Orr wrote:
 On 11/6/07, Jose Galvez [EMAIL PROTECTED] wrote:
   
 you could add
 for k,v in request.params:
 locals()[k] = v
 to the top f your functions

 this would inject the variable names into your functions do you could
 use them directly.
 

 You can't modify local variables via locals().  Local variables are
 implemented as an array with the names converted to subscripts at
 compile time. The only exception is if the function contains an
 'eval', which is slow and insecure (if the arg is untrusted).

 ===x1,py===
 def test():
 locals()[k] = v
 print k
 if __name__ == __main__:  test()
 ===

 $ python /tmp/x.py
 Traceback (most recent call last):
   File /tmp/x.py, line 5, in module
 if __name__ == __main__:  test()
   File /tmp/x.py, line 3, in test
 print k
 NameError: global name 'k' is not defined

 If you put k = 2 before the locals() call, it will print 2.


   
 I don't know what security risks this will bring up
 

 A user might override one of your variables like 'filename_to_delete'.

   

--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Mike Orr

On 11/6/07, Jose Galvez [EMAIL PROTECTED] wrote:

 you could add
 for k,v in request.params:
 locals()[k] = v
 to the top f your functions

 this would inject the variable names into your functions do you could
 use them directly.

You can't modify local variables via locals().  Local variables are
implemented as an array with the names converted to subscripts at
compile time. The only exception is if the function contains an
'eval', which is slow and insecure (if the arg is untrusted).

===x1,py===
def test():
locals()[k] = v
print k
if __name__ == __main__:  test()
===

$ python /tmp/x.py
Traceback (most recent call last):
  File /tmp/x.py, line 5, in module
if __name__ == __main__:  test()
  File /tmp/x.py, line 3, in test
print k
NameError: global name 'k' is not defined

If you put k = 2 before the locals() call, it will print 2.


 I don't know what security risks this will bring up

A user might override one of your variables like 'filename_to_delete'.

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Jonathan LaCour

Mike Orr wrote:

 The dictionary you return in the controller method will be used as  
 the
 namespace for your template.

 Are 'c' and the other Pylons variables implicitly added?

As of right now, they are not.  You will have to return them as part of
the dictionary that is sent to your template.

--
Jonathan LaCour
http://cleverdevil.org

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Temporary mailing list to send multiple emails

2007-11-06 Thread Daniele Paolella

Hi list.
This is not Pylons-specific but I think a sort of ensamble point of
view is needed, and since I'm working with the framework and strongly
agree with its principles, here it is.
I want to email thousands recipients from my application; in despite
of ease I need the user to send the message using her mail agent to
benefit from custom signature, external archiviation, Exchange
backing, ...
At the moment the application pops up several mailto requests, one
every 50 recipients - this is due to some limit in the number of
addresses handled by agents (or in the length of urls?), but this
doesn't scale up as the number of addresses grows.

So I had the enlightenment: creating a mailing list with needed
addresses, emailing the list from the client agent, then trashing the
list. I fell on GNU Mailman that seems to integrate neatly with
Postfix and has ad-hoc command line interface.
Now the questions: did I blow up my mind? May it worth the effort? Did
you ever need something like that? Maybe I'm missing a simpler gear to
accomplish this, for instance I have no clue on how to detect whether
a message has been delivered by Mailmain, so that I'm free to clear
the list.


--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Mike Orr

On 11/6/07, Jonathan LaCour [EMAIL PROTECTED] wrote:
 The dictionary you return in the controller method will be used as the
 namespace for your template.

Are 'c' and the other Pylons variables implicitly added?

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Mike Orr

On 11/6/07, Humberto Diógenes [EMAIL PROTECTED] wrote:
 I pulled the latest version from the repository but couldn't use it.


 ### Existing project:

 URL: http://localhost:5000/location/index
 File '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
 site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/error.py',
 line 245 in respond
   app_iter = self.application(environ, detect_start_response)
 File '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
 site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/wsgiapp.py',
 line 95 in __call__
   controller = self.resolve(environ, start_response)
 File '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
 site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/wsgiapp.py',
 line 173 in resolve
   match = environ['wsgiorg.routing_args'][1]
 KeyError: 'wsgiorg.routing_args'

This is going to be a recurring problem with Pylons-dev.  When
upgrading an app from Pylons 0.9.6 to 0.9.7, you have to add three
lines to middleware.py:


# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)

# Routing/Session/Cache Middleware
app = RoutesMiddleware(app, config['routes.map'])
app = SessionMiddleware(app, config)
app = CacheMiddleware(app, config)


Downgrading, you have to remove these lines, because Pylons 0.9.6
activates them implicitly.

 ### New project:

 $ paster create -t pylons PylonsTest2
 [...]
 OSError: [Errno 2] No such file or directory: '/Library/Frameworks/
 Python.framework/Versions/2.4/lib/python2.4/site-packages/
 Pylons-0.9.7dev_20071106-py2.4.egg/pylons/templates/default_project'

 $ ls -l /Library/Frameworks/Python.framework/Versions/2.4/lib/
 python2.4/site-packages/Pylons-0.9.7dev_20071106-py2.4.egg/pylons/
 templates/
 -rwxr-xr-x   1 root  admin0 Nov  6 19:02 __init__.py
 -rwxr-xr-x   1 root  admin  221 Nov  6 19:02 __init__.pyc

It works for me, both with my existing dev snapshot (d3c5b6893348) and
after hg pull -u (a7756badfe81).  Maybe you got an incomplete
update?

$ ls -l ~/mercurial/Pylons/pylons/templates
total 20
-rw-r--r-- 1 mso mso  281 2007-10-22 12:36 controller.py_tmpl
drwxr-xr-x 5 mso mso 4096 2007-10-22 12:36 default_project
-rw-r--r-- 1 mso mso0 2007-10-22 12:36 __init__.py
drwxr-xr-x 4 mso mso 4096 2007-10-22 12:36 minimal_project
-rw-r--r-- 1 mso mso 2085 2007-10-22 12:36 restcontroller.py_tmpl
-rw-r--r-- 1 mso mso  200 2007-10-22 12:36 test_controller.py_tmpl

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Humberto Diógenes

On 06/11/2007, at 20:22, Mike Orr wrote:


 On 11/6/07, Humberto Diógenes [EMAIL PROTECTED] wrote:
 ### Existing project:
 URL: http://localhost:5000/location/index
 [...]
 KeyError: 'wsgiorg.routing_args'

 This is going to be a recurring problem with Pylons-dev.  When
 upgrading an app from Pylons 0.9.6 to 0.9.7, you have to add three
 lines to middleware.py:

 [...]

 Downgrading, you have to remove these lines, because Pylons 0.9.6
 activates them implicitly.


Thanks! It worked. Here goes the code with the right imports:


# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)

# Routing/Session/Cache Middleware (0.9.7 only, remove for 0.9.6)
from routes.middleware import RoutesMiddleware
from beaker.middleware import SessionMiddleware, CacheMiddleware

app = RoutesMiddleware(app, config['routes.map'])
app = SessionMiddleware(app, config)
app = CacheMiddleware(app, config)


 ### New project:

 $ paster create -t pylons PylonsTest2
 [...]
 OSError: [Errno 2] No such file or directory: '/Library/Frameworks/
 Python.framework/Versions/2.4/lib/python2.4/site-packages/
 Pylons-0.9.7dev_20071106-py2.4.egg/pylons/templates/default_project'


 It works for me (...) Maybe you got an incomplete update?

No, the update was OK, the files are in the checkout. I copied them
manually to Python site-packages and it worked.

I think there's something wrong with the install scripts. When I ran
easy_install . again, the templates were gone from site-packages.


Anyway, the new expose() decorator worked! Thanks!!! (although it
took a little to notice that BaseController was changed to
DecoratedController :-)


--
Humberto Diógenes
http://humberto.digi.com.br


--~--~-~--~~~---~--~~
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: Classic URL Style

2007-11-06 Thread Mike Orr

On Nov 6, 2007 4:19 PM, Humberto Diógenes [EMAIL PROTECTED] wrote:
 I think there's something wrong with the install scripts. When I ran
 easy_install . again, the templates were gone from site-packages.

is it possible to easy_install a development version in Mercurial?

I used python setup.py develop

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



db update notifier for pylons app

2007-11-06 Thread kettle

Hi,  I am fairly new to pylons and have what may be a simple
implementation question.  I have an html table which displays the
(partial) contents of a database, and I would like to dynamically, and
parsimoniously update this table each time an entry is added to the
database.

  The first, simplest, crudest solution that came to mind was
implementing an html refresh option directly in the html for the
template.  This is not very nice.
  The second solution that comes to mind is to use javascript and a
periodic xmlhttprequest to update the table every n seconds.  This is
preferable to the first solution but it doesn't really get at my real
problem, which is how to achive immediate notification upon a state
change in the database.  In order to duplicate the effect I have to
call the xmlhttprequest every second, which is quite wasteful.
  I'm using mysql to store my data, and I know mysql supports a
TRIGGER function, and I wonder if there might be some way to use this
and a javascript connection that returns only upon timeout or a db
state change?  Or maybe that makes no sense at all?  I would prefer
not to require the client to install anything on his machine.
  If anyone has any ideas about what is or is not possible any help is
welcome.

thanks!


--~--~-~--~~~---~--~~
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: db update notifier for pylons app

2007-11-06 Thread kettle

Also, I am using sqlalchemy with pylons.
kettle wrote:
 Hi,  I am fairly new to pylons and have what may be a simple
 implementation question.  I have an html table which displays the
 (partial) contents of a database, and I would like to dynamically, and
 parsimoniously update this table each time an entry is added to the
 database.

   The first, simplest, crudest solution that came to mind was
 implementing an html refresh option directly in the html for the
 template.  This is not very nice.
   The second solution that comes to mind is to use javascript and a
 periodic xmlhttprequest to update the table every n seconds.  This is
 preferable to the first solution but it doesn't really get at my real
 problem, which is how to achive immediate notification upon a state
 change in the database.  In order to duplicate the effect I have to
 call the xmlhttprequest every second, which is quite wasteful.
   I'm using mysql to store my data, and I know mysql supports a
 TRIGGER function, and I wonder if there might be some way to use this
 and a javascript connection that returns only upon timeout or a db
 state change?  Or maybe that makes no sense at all?  I would prefer
 not to require the client to install anything on his machine.
   If anyone has any ideas about what is or is not possible any help is
 welcome.

 thanks!


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---