Re: [web2py] Re: Create a service running continuously

2016-03-06 Thread Paul Gerrard
Hi thanks for the suggestions. Sorry for not responding sooner. I figured a
way of working and been working abroad for a few days...) so I haven't
tried your suggestions.

What worked for me was I wrote a service that returned the contents of a
table that define the bot commands and called it using requests in Python.
The response contains the data as json. Then I connect to my Slack room and
listen for commands that invoke my bot. the bot responds according to the
commands received and looked-up responses read from the DB.

I suspect using the DAL directly could have achieved the same goal and also
retain the DB connection to store stuff too if required - but right now I
don't need to do that.

Happy to share my code if you have a similar need to drive a Slack bot.



On 2 March 2016 at 20:42, Ian Ryder <i.ry...@appichar.com.au> wrote:

> Sounds like you just need some sort of never ending loop (obviously you
> can put checks in the loop for stop requests and whatever other complexity
> you like / need).
>
> You can pass arguments on the python command line. So for example you
> could do something like:
>
> python web2py.py -S your_app -M -A 1 run_my_loop
>
> In the example, 1 is the user record to use and then:
>
> if sys.argv[2] == 'run_my_loop':
> this_user = db_auth.auth_user[sys.argv[1]]
>
>
> if not this_user:
> raise Exception('...')
> auth.login_bare(this_user.email, this_user.password)
> run_my_loop()
>
>
>
> On Monday, 29 February 2016 10:36:23 UTC+1, Paul Gerrard wrote:
>>
>> I have written some Python code to act as a chatbot working with Slack.
>> All looks good so far. I could add it as a service to /etc/init.d etc and
>> make it work at startup. However...
>>
>> I want to enhance the service to access my MySQL database using the
>> Web2py DAL. Now, I created a webservice to do this - but of course when run
>> the Apache server eventually times out and I get a 500 error. Is there a
>> simple way of creating a permanently running service that can access
>> models, the DAL etc?
>>
>> Now, in the web2py directory, I guess I could run:
>>
>> python -M -S myapp/controller/function
>>
>> But I need to add credentials to the command too? How do I do this?
>>
>> Assuming there's a way to provide credentials through the shell, would a
>> permanently running service created this way cause any other issues?
>>
>> thanks, Paul.
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/XEbLuixLJUY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Create a service running continuously

2016-02-29 Thread Paul Gerrard
I have written some Python code to act as a chatbot working with Slack. All 
looks good so far. I could add it as a service to /etc/init.d etc and make 
it work at startup. However...

I want to enhance the service to access my MySQL database using the Web2py 
DAL. Now, I created a webservice to do this - but of course when run the 
Apache server eventually times out and I get a 500 error. Is there a simple 
way of creating a permanently running service that can access models, the 
DAL etc?

Now, in the web2py directory, I guess I could run:

python -M -S myapp/controller/function

But I need to add credentials to the command too? How do I do this?

Assuming there's a way to provide credentials through the shell, would a 
permanently running service created this way cause any other issues?

thanks, Paul.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: raspberry pi

2013-01-09 Thread Paul Gerrard


On Sunday, 23 December 2012 04:49:45 UTC, Paul Gerrard wrote:

 I've had two RPIs for several months. My first task was to install Web2py 
 and our app on it (Apache, MySQL and 90 tables etc.) and it worked fine. I 
 used an 8Gb SD card. It wasn't lightning fast, but as a potential test/demo 
 environment it worked fine.

 Paul.

 On Wednesday, 9 January 2013 22:19:50 UTC, Massimo Di Pierro wrote:

 This is going on reddit.com immediately!
 Time for me to buy a raspberrypi.

 Massimo



 On Wednesday, 9 January 2013 12:37:45 UTC-6, Peter Etchells wrote:

 web2py for home automation:


 http://www.instructables.com/id/Raspberry-Pi-GPIO-home-automation/#intro



-- 





[web2py] Re: raspberry pi

2013-01-09 Thread Paul Gerrard


On Wednesday, 9 January 2013 22:33:18 UTC, Paul Gerrard wrote:



 On Sunday, 23 December 2012 04:49:45 UTC, Paul Gerrard wrote:

 I've had two RPIs for several months. My first task was to install Web2py 
 and our app on it (Apache, MySQL and 90 tables etc.) and it worked fine. I 
 used an 8Gb SD card. It wasn't lightning fast, but as a potential test/demo 
 environment it worked fine.

 Paul.

 On Wednesday, 9 January 2013 22:19:50 UTC, Massimo Di Pierro wrote:

 This is going on reddit.com immediately!
 Time for me to buy a raspberrypi.

 Massimo



 On Wednesday, 9 January 2013 12:37:45 UTC-6, Peter Etchells wrote:

 web2py for home automation:


 http://www.instructables.com/id/Raspberry-Pi-GPIO-home-automation/#intro



-- 





[web2py] Re: raspberry pi

2012-12-22 Thread Paul Gerrard
I've had two RPIs for several months. My first task was to install Web2py 
and our app on it (Apache, MySQL and 90 tables etc.) and it worked fine. I 
used an 8Gb SD card. It wasn't lightning fast, but as a potential test/demo 
environment it worked fine.

Paul.

On Tuesday, 13 March 2012 10:04:40 UTC, Ramos wrote:

 it would be nice to be able to install web2py in raspberry pi

 http://www.raspberrypi.org/


-- 





[web2py] Calendar popup displays away from date fields in Internet Explorer

2012-08-28 Thread Paul Gerrard
Hi,

I'm using the calendar popup on Firefox and Chrome and all is well. But on 
Internet Explorer, the popup appears several inches higher on the page away 
from date fields. If your date field is a couple of inches from the top of 
the displayed window, the popup appears off screen. Most disconcerting.

I'm using Web2py 1.99.2, but I took the calendar.js and calendar.css from 
the latest version of Web2py (1.99.7) and it exhibits the same behaviour in 
my environment.

Does anyone have any suggestions for what I'm doing wrong? Is there some 
browser-specific code I should be using somewhere?

thanks,
Paul.

-- 





[web2py] Re: column auth_user.registration_id does not exist ERROR AFTER UPGRADE to 1.99

2012-05-28 Thread Paul Gerrard
I just had the same problem on a test version of my apps. I'm using MYSQL. 
The field is missing and it isn't being autocreated because 
Migrations=False in my db.py model, I have 

auth.define_tables(migrate=False)

Using fake_migrate True and then trying to migrate to reset doesn't work 
either. I get Dupe table message then.

What is the definition of this field? It seems to be created by code in 
tools.py - but what's the MySQL field definition - I'll create manually.

I expect to have the same problem in another 20 or so MySQL DBs. My guess 
is it's a MySQL specific issue. I have update DB defs manually (using 
scripts) for two years as it's too much hassle to do it any other way in a 
large complex DB.

Paul G.


[web2py] Re: dropbox python api

2012-04-09 Thread Paul Gerrard
Hi,

I got distracted by other things and only just came back to this. The 
problem I was having was in my code was the token was 'disabled or 
invalid'. I'm sure this is resolved by using the callback in the redirect 
back from the Dropbox site. I commented out the code that's not relevant 
for me in your code and it works fine now.

As for using cron - I expect you could skip the redirect and go from line 
191 directly to 204. Presumably you need a try/except around 204?

Paul.

On Thursday, 5 January 2012 17:28:41 UTC, Joseph Jude wrote:

 If anyone is interested, you can look into the code for dropbox connection 
 here:

 http://goo.gl/QYT2y

 This is my default.py. Look at dropbox_connect  and process_dropbox.

 Question: How can I automate this with cron? When I do it, it stops with 
 the redirect.

 Thank you,
 Joseph



[web2py] Re: dropbox python api

2012-01-04 Thread Paul Gerrard
I just started looking at Dropbox yesterday. I've created some code
that works in the python interpreter just fine, but when I paste to a
web2py controller it fails. I suspect it's because the Dropbox module
uses a variable calls 'session' that actually uses the Web2py session
variable.

Is there an easy way around this (e.g. do I need to put the Dropbox
code into a model?) or do I need to use your code mentioned above? Did
you get feedback on the code - is it reliable?

Thanks, as always,

Paul.

On Jan 3, 3:38 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Only dropbox

 On Jan 2, 7:38 pm, Joseph Jude ceph...@gmail.com wrote:







  To use this do you need APIs both from dropbox  janrain?

  Thank you,
  Joseph


[web2py] Re: migrate file system uploads to database?

2011-10-17 Thread Paul Gerrard
Hi,

You beat me to it. I came up with almost exactly the same code myself
over the weekend. Worked a treat. :O)

Paul.

On Oct 15, 2:35 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Say you have

 db.define_table('mytable',Field('file','upload'))

 step 1: add a blob

 db.define_table('mytable',Field('file','upload',uploadfield='fileblob'),Fie 
 ld('fileblob','blob')

 step 2 move the data in blob:

 for row in db(db.mytable).select():
     if row.fileand not row.fileblob:
        data =
 open(os.path.join(request.folder,'uploads',row.file),'rb').read()
        row.update_record(fileblob=data)
        db.commit()

 Done

 On Oct 14, 6:16 pm, Paul Gerrard p...@gerrardconsulting.com wrote:







  Hi all,

  I have the same requirement - moving a directory of upload files into
  thedatabase. I was thinking the way to do it would be to copy the
  original table definition, then make the field changes to the table
  definitions, then write a script to process all thefile-based records
  and post them into the new table. Sounds simple but probably isn't.

  Has anyone got a working script to do this perhaps?

  Paul.


[web2py] Re: IMPORTANT

2011-10-14 Thread Paul Gerrard
My 2p worth.

I run a couple of communities relating to software testing. One is
public (uktmf.com) one is private (testers-retreat.org) and this kind
of discussion arises from time to time, often about face to face
communications. People who are passionate DO get upset - it happens.
Testers are a particularly pedantic lot and see their mission in life
to be critical. So testers are 'ten times worse'.

This forum is about web2py for users of it and developers of it.

There's a famous poem by W.B. Yeats http://elise.com/quotes/quotes/yeats.htm
... tread softly because you tread on my dreams.

If you share your dreams here - people will tread on them if they
don't share them. Period. So if you have a passion that isn't web2py
or python or related - watch out - you may offend and be offended.

For example. This is just an EXAMPLE. No offence Gour, but I don't
think your quote stacks up. Let me critique it very quickly. All
concepts are mental contrivances. So conceptions of anything are
mental speculations. In ANY world. So the quote says nothing and its
just plain wrong anyway. Have we enriched humanity by sharing the
quote or critiquing it? Of course not. It's just noise.

Now everyone could critique everyone elses quasi-religious, -mystic or
-philosophic statements made in the forum. But it really won't get us
anywhere.

It's just noise and detracts from the purpose of the group. So put
your non-web2py musings somewhere else. It's not because you may
offend it's because criticism may offend you and there are plenty
other forums for that kind of thing. So the policy should be - bring
germane content in here or expect to be criticised - politely at all
times of course.


[web2py] Re: migrate file system uploads to database?

2011-10-14 Thread Paul Gerrard
Hi all,

I have the same requirement - moving a directory of upload files into
the database. I was thinking the way to do it would be to copy the
original table definition, then make the field changes to the table
definitions, then write a script to process all the file-based records
and post them into the new table. Sounds simple but probably isn't.

Has anyone got a working script to do this perhaps?

Paul.



[web2py] Re: featured web2py apps

2011-09-23 Thread Paul Gerrard
Hi Massimo,

Can we have a separate ist of commercial apps to? (Some of us have to
make a living :O))

Paul.

On Sep 22, 7:59 pm, Anthony abasta...@gmail.com wrote:
 Why does it have to use Auth? What if access control isn't relevant for the
 particular app?

 Anthony



 On Thursday, September 22, 2011 2:52:05 PM UTC-4, Massimo Di Pierro wrote:

  I think we should make a list of featured web2py apps. Please post
  links below.

  - it does matter if you wrote or just saw it, just post below
  - the app must be open source
  - the app must be under version control and available
  - the app must use Auth
  - avoid duplicates, but if you saw in a previous thread, please post
  it here again

  List:
  - app name
  - app author
  - app description
  - where to get it
  - possibly a link to a screenshot
  - whether you think it is stable or not (why not?)

  Massimo- Hide quoted text -

 - Show quoted text -


[web2py] Re: Date Picker Widget

2011-09-08 Thread Paul Gerrard
Hi,

I used this css as is (although I did change the background colour to
match my site. however... I'm using the dat picker on a field
displayed in a jquerydialog. the datepicket pops up - behind the
dialog box. I think the z-indexvalue needs bumping up (or is it
down?)

Looks good tho :O)

On Sep 7, 7:23 am, annet annet.verm...@gmail.com wrote:
 Hi David,

 I didn't like the calendar that comes with web2py, not for its
 functionality but for its appearance. Instead of replacing it I just
 restyled it:

 .calendar {
   cursor: default;
   background-color: #FF;
   color: #44;
   font-size: 11px;
   border: 1px solid #AA;
   border-radius: 6px;
   -webkit-border-radius: 6px;
   -moz-border-radius: 6px;
   padding: 6px;}

 .calendar table {
   border-collapse: separate;
   border-spacing: 2px;}

 .calendar thead {}
 .calendar thead tr, .calendar thead .headrow {
   background-color: #4169E1;
   color: #44;}

 .calendar thead .daynames {}
 .calendar .button, .calendar thead .title {
   color: #FF;
   font-size: 12px;
   text-align: center;
   padding: 3px;}

 .calendar thead tr .hilite, .calendar thead tr .active, .calendar
 thead .headrow .hilite, .calendar thead .headrow .active {
   background-color: #FF;
   color: #4169E1;
   padding: 3px;}

 .calendar thead .daynames .hilite, .calendar thead .daynames .active {
   background-color: #FF;
   color: #44;}

 .calendar thead .name {
   background-color: #FF;
   text-align: center;
   padding: 3px;}

 .calendar tbody {}
 .calendar tbody td {
   text-align: right;
   border: 1px solid #AA;}

 .calendar tbody td.hilite {
   background-color: #77;
   color: #FF;}

 .calendar tbody td.active, .calendar tbody td.selected {
   font-weight: bold;
   background-color: #FF;
   color: #4169E1;}

 .calendar tbody td.today {
   font-weight: bold;
   background-color: #4169E1;
   color: #FF;}

 .calendar tbody .disabled {
   color: #77;}

 .calendar tbody .emptycell {
   visibility: hidden;}

 .calendar tbody .emptyrow {
   display: none;}

 .calendar tfoot .ttip {
   background-color: #77;
   color: #FF;
   text-align: center;
   border: 1px solid #33;
   padding: 1px;}

 .calendar tfoot .hilite {
   padding: 1px;
   background-color:
   #EE;}

 .calendar tfoot .active {
   padding: 2px 0px 0px 2px;}

 .calendar .combo {
   background-color: #FF;
   position: absolute;
   display: none;
   width: 4em;
   top: 0px;
   left: 0px;
   cursor: default;
   border: 1px solid #DD;
   padding: 1px;
   z-index: 100;}

 .calendar .combo .label, .calendar .combo .label-IEfix {
   text-align: center;
   padding: 1px;}

 .calendar .combo .label-IEfix {
   width: 4em;}

 .calendar .combo .active {
   background-color: #CC;
   color: #FF;
   padding: 0px;}

 .calendar .combo .hilite {
   background-color: #77;
   color: #FF;}

 .floatleft {
   float: left;}

 .CP_over {
   background-color: #FF
  }

 Just another option ;-)

 Kind regards,

 Annet.


[web2py] web2py_ajax.js - jQuery().html v DOM innerHTML issue

2011-07-17 Thread Paul Gerrard
Hi,

Today, I upgraded my web2py version from 191.6 to 1.97.1 - all went
well except where I had used the autocomplete jquery plugin on jquery
dialog boxes. (I do thsi lots of times). Let me explain.

1. I create a dialog box using jquere dialog plug in
2. Then I use Web2py ajax to populate the div with the content which
is a form
3. After the ajax load, I use a javascript routine with a timer to
attempt to assign the autocomplete addin to a select field in the
form.

All worked well in the upgrade except this. The autocomplete code
fails  with a message saying the select has no method 'combobox'

Now, I tracked the 'problem' down to the line of code in
web2py_ajax.js in the jQuery ajax call that puts the ajax content into
the div in my dialog boxes:

v 1.97.1 jQuery(# + t).html(msg); (the new way - DOES NOT WORK)
v 1.91.6 document.getElementById(t).innerHTML=msg; (the old way -
WORKS)

So I've made that change temporarily in web2py_ajax.js. Looking around
the web, there seems to be a general view that innerHTML isn't the
best way to load content into fields.

Can anyone explain the difference in behaviour and what I need to
consider in adopting the new style ajax routine? Or is this a bug???


[web2py] Re: web2py_ajax.js - jQuery().html v DOM innerHTML issue

2011-07-17 Thread Paul Gerrard
It now appears the ajax routine won't for me at all in some cases. It
looks like it's not passing the value of the field in the second
parameter to the POST to the server.

Any ideas?

Paul.

On Jul 17, 4:24 pm, Paul Gerrard p...@gerrardconsulting.com wrote:
 Hi,

 Today, I upgraded my web2py version from 191.6 to 1.97.1 - all went
 well except where I had used the autocomplete jquery plugin on jquery
 dialog boxes. (I do thsi lots of times). Let me explain.

 1. I create a dialog box using jquere dialog plug in
 2. Then I use Web2py ajax to populate the div with the content which
 is a form
 3. After the ajax load, I use a javascript routine with a timer to
 attempt to assign the autocomplete addin to a select field in the
 form.

 All worked well in the upgrade except this. The autocomplete code
 fails  with a message saying the select has no method 'combobox'

 Now, I tracked the 'problem' down to the line of code in
 web2py_ajax.js in the jQuery ajax call that puts the ajax content into
 the div in my dialog boxes:

 v 1.97.1 jQuery(# + t).html(msg); (the new way - DOES NOT WORK)
 v 1.91.6 document.getElementById(t).innerHTML=msg; (the old way -
 WORKS)

 So I've made that change temporarily in web2py_ajax.js. Looking around
 the web, there seems to be a general view that innerHTML isn't the
 best way to load content into fields.

 Can anyone explain the difference in behaviour and what I need to
 consider in adopting the new style ajax routine? Or is this a bug???


[web2py] Re: For Massimo: which version of book to buy?

2011-06-22 Thread Paul Gerrard
Call me old-fashioned, but I for one *prefer* the paper book to online
8O)

Online is a good fall-back if I can't find what I want.

Things are moving quickly - when will the next paper version be
available?

Paul.


[web2py] Uploading a zip file

2011-04-06 Thread Paul Gerrard
I'm trying to export some files generated from my application. I'm
creating a zip file with the file in directly (using Python) and the
zip file is created fine. Then I want to upload that file to the DB to
allow them to download it from the uploads directory. The code snippet
below works fine and a file is uploaded, but the file is corrupted (it
has just a few hundred byeted in it.

db.py
db.define_table(exportitem,
SQLField(org_id, db.organisations, notnull=True,
writable=False, default=session.org_id),
SQLField(app_id, integer, default=session.app_id,
notnull=True),
SQLField(proj_id, integer, default=session.proj_id,
notnull=True),
SQLField(title, string, length=50, notnull=True,
label=Title),
SQLField(created, datetime, notnull=True,
default=datetime.today(), label=Created, writable=False),
SQLField(created_by, db.auth_user, notnull=True,
default=session.user_id, writable=False),
SQLField(exportfile, upload, notnull=True),
migrate=migrate,fake_migrate=fake_migrate)

testzip()
fname=''.join((str(session.org_id),str(datetime.today(
my_crypt = CRYPT(key=auth.settings.hmac_key)
zname = ''.join((my_crypt(fname)[0],'.zip'))

 
zfile='/'.join((request.env.web2py_path,'applications',request.application,'temp',zname))
#
#
#
#
#   now store the file in the database.
#
zid=db.exportitem.insert(title='testing the zip file
generator',exportfile=db.exportitem.exportfile.store(open(zfile,'rb')))


[web2py] Uploading a zip file

2011-04-06 Thread Paul Gerrard
I'm trying to export some files generated from my application and
provide them as a zip file to the user. I'm creating a zip file using
Python zipfile module and the zip file is created fine. Then I upload
that file to the DB to allow them to download it from the usual
uploads directory. The code snippet below works fine and a file is
uploaded, but the file is corrupted somehow.

db.py
db.define_table(exportitem,
SQLField(org_id, db.organisations, notnull=True,
writable=False, default=session.org_id),
SQLField(app_id, integer, default=session.app_id,
notnull=True),
SQLField(proj_id, integer, default=session.proj_id,
notnull=True),
SQLField(title, string, length=50, notnull=True,
label=Title),
SQLField(created, datetime, notnull=True,
default=datetime.today(), label=Created, writable=False),
SQLField(created_by, db.auth_user, notnull=True,
default=session.user_id, writable=False),
SQLField(exportfile, upload, notnull=True),
migrate=migrate,fake_migrate=fake_migrate)

testzip()
fname=''.join((str(session.org_id),str(datetime.today(
my_crypt = CRYPT(key=auth.settings.hmac_key)
zname = ''.join((my_crypt(fname)[0],'.zip'))

 
zfile='/'.join((request.env.web2py_path,'applications',request.application,'temp',zname))
#
# zipfile created here in temp directory
#

#
#   now store the file in the database.
#
zid=db.exportitem.insert(title='testing the zip file
generator',exportfile=db.exportitem.exportfile.store(open(zfile,'rb')))

The file stored in the uploads directory is corrupted - and not
identical to the original of course.

Am I missing something?


[web2py] Using my own dropdown lists

2011-03-25 Thread Paul Gerrard
Hi,

I have a screen transaction that uses a select drop down list that i
create myself using code in my controller. All works well except when
I have an error on another field, Web2py highlights the error on
screen, but if I've made a selection using the drop down list, the
selection made (if different from the original stored value)  is not
kept and the dropdown returns to the original value.

If I have errors in a form, how do i pass the value selected on a page
to the routine in my controller that generates the drop down?

I thought it was form.vars.fieldname - but it doesn't seem to work :O(

How do I capture the 'last submitted' values on a form so I can re-
display them on a form or use them in my controller?

Any suggestions?

Paul.


[web2py] Re: Using my own dropdown lists

2011-03-25 Thread Paul Gerrard
Sorry - false alarm. It's exactly as it should be - a typo in my code
threw me completely.

form.vars.fieldname is of course the way to go. Doh! :O)

Paul.


[web2py] Re: DAL Selects with multiple conditions - AND versus

2011-02-18 Thread Paul Gerrard
Thanks both for the feedback. I think I'll just have to stay on top of
my DAL calls :O)

Paul.

On Feb 17, 7:15 pm, Marin Pranjic marin.pran...@gmail.com wrote:
 It's because of pythons limitations in overloading operators.
 You can change behavior of , |, ~ in python, but cannot change and, or,
 not.

 On Thu, Feb 17, 2011 at 7:00 PM, Paul Gerrard 
 p...@gerrardconsulting.comwrote:







  On more than one occasion, I've been caught out by a slip in my select
  statements. If you use 'and' rather than '' to combine criteria for a
  select you get different results. In the first case, (and) the code
  returns a single record, regardless of the values of the critieria
  used for the selection. In the second case () I get the correct
  record depending on the value of termkey.

  # this doesn't work
  #
  glossary=db((db.glossaryterms.termkey==termkey) and
  (db.glossaryterms.org_id==session.org_id)).select()
  #
  # this does work
  glossary=db((db.glossaryterms.termkey==termkey) 
  (db.glossaryterms.org_id==session.org_id)).select()

  My question is: should using 'and' work at all or is it precluded as a
  keyword in queries? As it is I've lost hours trying to figure out the
  problem.

  If 'and' should work - there's a bug in DAL I think.
  If 'and' should not work, then it would be really helpful if the DAL
  rejected with a runtime failure message so it doesn't waste a lot of
  time.


[web2py] DAL Selects with multiple conditions - AND versus

2011-02-17 Thread Paul Gerrard
On more than one occasion, I've been caught out by a slip in my select
statements. If you use 'and' rather than '' to combine criteria for a
select you get different results. In the first case, (and) the code
returns a single record, regardless of the values of the critieria
used for the selection. In the second case () I get the correct
record depending on the value of termkey.

# this doesn't work
#
glossary=db((db.glossaryterms.termkey==termkey) and
(db.glossaryterms.org_id==session.org_id)).select()
#
# this does work
glossary=db((db.glossaryterms.termkey==termkey) 
(db.glossaryterms.org_id==session.org_id)).select()

My question is: should using 'and' work at all or is it precluded as a
keyword in queries? As it is I've lost hours trying to figure out the
problem.

If 'and' should work - there's a bug in DAL I think.
If 'and' should not work, then it would be really helpful if the DAL
rejected with a runtime failure message so it doesn't waste a lot of
time.


[web2py] Re: web2py organization - important for consultants !!!

2010-11-12 Thread Paul Gerrard
Here are my comments on the Guidelines page. Some of these are
duplicates with other peoples' comments - but what the heck. --- is
my suggestion


...Our choice of technologies is motivated but a belief in Rapid
Application Development(RAD)
---by

...application. The occurrence of faled prototypes
   -failed

... A system analyst should be endowed with decision
  -systems---granted

... It may compromise on aestetic issues and
 ---aesthetic

... evelopment, but, it is not as an
   --remove comma

... executing the full project project.
  ---remove repeated 'project'.

... we dare to say so and start again.
   add 'or withdraw from the
project'?

... The business model behind FOSS is that
  --- define FOSS

Use Open Standards and Interoprability
   Interoperability

... by the Europen Union in its European Interoperability Framework:
add a link to the standard?

Use Industry Standard Tehcnologies
  Technologies

... and it plays a singificantrole in the
   ---significant role

... therefore less wise-spread. This gives us an hedge vs our
competitors.
   ---widespread---edge over our
competitors.

... Portability is crytical to maximize
   ---critical

... We build software is portable and can un efficienly on most
computing Clouds.
 ---add 'that'   ---run

... optimization may be specific of each individual cloud
technologies
 --to

A more general point: There's no mention of Agile approaches - surely
we need to include that?

Question: Do you register an interest by using the 'Contact Us' page?
It's not clear, I'm afraid. I'm interested!


[web2py] Looking to make contact with (UK based) dev/collaborators

2010-11-02 Thread Paul Gerrard
Hi,

I'm currently building an application which we will host on our
servers as a pay-for-use commercial service. We're making contact with
some beta evaluators who we hope will help us to refine the product
and hopefully, pay for the service and be our initial reference sites.
The website will be testela.com - its not live yet - but our staging/
test and live sites are set up under different urls.

Currently, I'm doing all the coding, but I need to come out of my cave
and 'get out there' to sell the concept and the product. So I'm
looking to offload some, perhaps all of my dev workload. I have a
tester (who is my non-exec chair :O)), and I'll do some testing and
act as Product Owner. We'll probably operate a variation of Scrum to
manage the work.

The tool is intended to support large projects to help them manage
requirements, collect user stories to example the requirements and to
build comprehensive system/acceptance tests. A smaller and different
cut of the functionality will be offered as a support tool for Agile
projects using Scrum. The tool will evolve to include full test
execution management and probably integration with test execution
tools.

We'll use the tool to help us manage the project to build the tool.
(Eating own dogfood etc.)

I'm interested in hearing from smart developers with experience in any
(or even all!) of the following. I've separated the current from the
futures.

What we use today:
Web2py, Python, HTML, CSS (obviously!)
(Ubuntu) Linux, Apache
MySQL
jquery, jqgrid, AJAX

Futures:
Web Services for clients to extract data from the tool (where
required)
Testing frameworks (to link to tools that developers/system testers
use)
Source code management tool (possibly Git) and maybe a reliable
automated build process - this is a priority
Interfaces to test execution tools such as Selenium, Webdriver or
proprietary tools like QTP etc. etc.

And oh, yes, we expect to pay for services rendered! The relationship
could evolve into a full time role or long term partnership. Let's
see. :O)

I'm based in Maidenhead, UK. Now it would be nice to meet people face
to face in the UK, but that's a nice to have and if you are on the
other side of the world - maybe it's not a problem.

Drop me a note here, or mail me at paul at gerrardconsulting dot com.
(Our drupal based website is also due for a refresh so it doesn't
mention Testela - yet).

Thanks.


[web2py] DB Select with date criteria

2010-10-12 Thread Paul Gerrard
Hi,

I can't find a usable reference to selecting records from a database
table based on the value of datetime fields. Here's my situation:

I have a table with two date fields:

db.define_table(announcements,
SQLField(validfrom, datetime, notnull=True,
default=datetime.today(), label=Valid from),
SQLField(expires, datetime, notnull=True,
default=datetime.today()+timedelta(days=3), label=Expires),
SQLField(author_id, db.auth_user, default=session.user_id),
SQLField(subject, string, length=100, notnull=True,
label=Subject),
SQLField(message, text, notnull=True, label=Message))

I want to select records that are valid as follows:

anns = db( ( db.announcements.validfromdatetime.today() ) and \
( db.announcements.expiresdatetime.today() ) ) .select()

That is, expires date is in the future and the validfrom date is in
the past.

This code doesn't seem to work, as all records are returned,
regardless of the date values.

This must be a common requirement - any suggestions?


[web2py] Re: DB Select with date criteria

2010-10-12 Thread Paul Gerrard
Hi,

Many thanks. Tried it and it didn't work. I had a rather subtle error
in my code it seems... and then it worked just fine.

Sometimes just changing some code rather than staring at it triggers a
chain of failure and thinking events and the solution emerges!

Thanks for the tip - much appreciated.

Paul.

On Oct 12, 11:07 am, annet annet.verm...@gmail.com wrote:
 Hi Paul,

 I faced a similar problem and worked out the following solution:

 db.define_tables(publications,
     Field('publish','date',default=request.now,notnull=True),
     Field('expire','date',default=request.now
 +datetime.timedelta(days=28),notnull=True),
     Field(...))

 rows=db((db.publications.publish=request.now)(db.publications.expirerequ 
 est.now)).select()

 I hopes this points you in the right direction to solve your problem.

 Kind regards,

 Annet.


[web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-24 Thread Paul Gerrard
.

   Although I haven't spent too much time with Mercurial, most concepts
  don't change, and implementation well... that's all it is really. I
  had look @ your src repository and I find it is very telling of how
  you do things and what is important. As I understand, the goal is to
  meet 2 separate requirements that inevitably impact one another with
  current structure. The desired outcome: no freeze of the code line
  while allowing for planned testing iterations to move forward (while
  enabling Mr Di Pierro to maintain those elements of the current model
  which are important to him). I think it's entirely doable and please
  don't hesitate to stop me if I get carried away... I would like to
  start, if there are no objections, by getting a high level
  understanding of current practices. So, I'll throw a few questions out
  there. (I will try t keep the number of questions short – although it
  may not appear that way). Perhaps, this could be taken to another area
  to minimize the ruckus?

  I like the idea of getting a group together and collaborate on
  developing a proposal. As the more input we have, the better we can
  serve this type of development model (the concept of contributors) in
  the web2py dev world in particular. I see that Mr Di Pierro commits
  all changes to the single branch (default).

  Here's are a few questions with that:

  Where do developers check-in or commit their changes while in
  development?
  Where does the src going to dev come from and at what frequency does
  it get synced with the reference code line (if at all) ?
  Is the reference code line stable (no changes) or is it in constant
  flux?

  Since Massimo, is doing the commits, I assume that everybody keeps a
  sandbox copy of the src? Is there a mechanism in place which makes
  sure that everyone is working off the same starting point? If not, how
  are merge conflicts handled presently?

  Does the code get reviewed before making its way to Massimo who will
  be committing the changes (or not committing)?

  As the “release guy”, my first and most important consumer of builds
  is QA  - the testers usually get first dibs on my time ;) - as they
  are the ones blessing builds and enabling them to move to the next
  levels. I tend to want to have them in mind when writing automation
  and making sure they can interface as smoothly as possible to my
  automation with there own.

  When going to Test, what get's handed off (src or build)?
  Is there any regular automated/manual testing? Or is it the case where
  bigger testing efforts are done  later in the release cycle?
  how are builds identified with those test results?

   Good release strategies do help, so here are just a few questions on
  that subject:

  Have you a defined plan for release strategies? (i.e. moving forward
  between releases from 1.83.x to1.84.x,  to 1.90.x etc.) - or are
  releases treated as milestones?
  milestone strategies within those releases?
  how do you keep track of previous releases?

  So, depending on the extent of adherence to release practices we want
  to look at, there are many elements worthy of attention. I am ready
  and willing to spend time in helping web2py plan and implement release
  methodology (if that is desired) in line with your growth expectation
  (which I can only imagine it being very high). What I can do to start
  is setup a structure on Google (although i have noe clue yet what the
  procedures are yet to get that going... a simple sign up?) and play
  with a few ideas. So, where do we go from here, meaning how do we get
  a group of interested people to join in?

  I am open for discussion with anyone interested.

  Thanks,
  Mart :)

  On Aug 22, 1:11 pm, mart msenecal...@gmail.com wrote:
  This is sounding like fun! My experience is mostly with Adobe (10
  years) working with cross-continent  distributed dev efforts. So,
  getting the chance to work with the great folks from web2py on a
  contribution model (for the lack of a better term) sounds real
  exciting to me! :)

  thanks,
  Mart :)

  On Aug 22, 12:12 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I propose the people most competent and interested in this subject
   form a team to work on it.
   Call for help, setup a mailing list and an IRC channel. I will be
   happy to use/incorporate a testing suite.

   Massimo

   On Aug 22, 10:57 am, Paul Gerrard p...@gerrardconsulting.com wrote:

Hi All,

Like Mart - I'd better declare an interest and some knowledge in this
area.

My company is Gerrard Consulting (www.gerrardconsulting.com) I'm very
active in the UK and European testing community and have written a
couple of books, done lots of conference work, host the UK Test
Management Forum (uktmf.com) etc. etc. I am using Web2py to create a
test management tool that we will use to support our testing services.
(It's mainly for test design and record keeping in large software
projects, rather than

[web2py] Re: Should we have a feature freeze and stability maintenance period in future?

2010-08-22 Thread Paul Gerrard
Hi All,

Like Mart - I'd better declare an interest and some knowledge in this
area.

My company is Gerrard Consulting (www.gerrardconsulting.com) I'm very
active in the UK and European testing community and have written a
couple of books, done lots of conference work, host the UK Test
Management Forum (uktmf.com) etc. etc. I am using Web2py to create a
test management tool that we will use to support our testing services.
(It's mainly for test design and record keeping in large software
projects, rather than test execution). So I am very interested in a
rock-solid Web2py as my company will depend on it :O)

Right now, I'm full-on writing code and testing as we launch in mid-
September. But I will be creating a performance/stress test for our
app as we'll be making a free subset of the functionality available on
our servers.Obviously scalability is a concenr for us. I'll probably
use The Grinder (http://grinder.sourceforge.net/) to stage these
tests, but that won't be for 5-7 weeks I think.

I'd be very interested in collaborating to create some form of test
automation regime for the Web2py infrastructure and applications using
either available tools or maybe writing our own framework. (I'm
looking to build an interface from my tool to things like Fit/Fitnesse
(or replace them) and Selenium as I focus very much on acceptance
testing). This might be the subject of another thread, perhaps.

Sorry for the length of this, but I thought I should declare my hand
and support for a 'stabilisation period'.

Paul.


On Aug 22, 2:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Dear Mart,
 Your help is very much appreciated. In particular because I am not
 very knowledgeable about this aspect.
 I am old fashion and for me the less I use mercurial the better. For
 example I keep one single branch of web2py. I simply apply patches,
 test them, and either revert or commit. This  model has worked well
 for me and I would not like to change it.

 I too am uneasy with the idea of freezing but not with the idea of a
 testing period. How do you suggest we proceed?

 Massimo

 On Aug 22, 4:30 am, mart msenecal...@gmail.com wrote:



  Good evening all,

  I hope no one takes offense by me jumping in, but I couldn't help
  myself as the thread's subject got my attention (release management is
  what I do). If you'll allow me, I'm just curious as to the narure of
  your current branching strategy wrt the subject of the thread? In my
  experience, freezing a code line is rarely beneficial, least of all to
  the release going forward. So, was wondering if finding the correct
  branching strategy (as well as defining an appropriately well matching
  high level root folder structure in your source CSM) would help in
  sorting out such things as separating out and accommodating the need
  for stability, moving forward and any iterative requirements in your
  release cycles? (I heard someone last year year - obviously someone of
  the newer generation - call this the need for speed ;) )  But
  regardless, if at all interested I'd be happy to do my part and help
  out in any way I can if such plans are being considered. BTW - I was
  hired to revamp and restructure release management processes last
  spring for US based company, and web2py (with some Flex pieces in it
  for demo purposes) was what I used to to showcase and spread the word
  about the proposed changes  :)

  On another note:
  I saw that some PDF libs were on there way for web2py  Awesome! I
  am looking forward to that! :)  I made a web2py app a few weeks ago
  (mixing the ReportLab's tool kit and Flex/iFrames) so that the kids in
  my daughter's violin class (yeah ok, this may be a little weird,
  but...) could generate fingerboard position markers (which are then
  convert to printable PDF templates) so that the kids could create the
  exact position markers for their instrument (I think she hates things
  that are pitchy). Anyways, did not want to use LiveCycle data services
  (with flex) for this (although it does do some good things), and even
  though the results I got with what I used were a little ok (or most
  probably, the problematic parts had something to do with the guy
  writing the code :) ), generating PDF with good tooling will be great!
  I'm already a fan! :)

  Thanks,
  Mart :)

  On Aug 22, 1:02 am, Jason Brower encomp...@gmail.com wrote:

   Again I think we have more pressure for testing tools.  Which I agree
   on.
   BR,
   Jason

   On Sun, 2010-08-22 at 00:32 -0400, Andrew Thompson wrote:
On 8/20/2010 4:54 PM, Phyo Arkar wrote:
 -bug-squishing-contest ,
 -Stress test, Test everything , try to crash web2py etc.

Could we build an app to act as a test harness?

Or a script to build an app per a test case, evaluate it, then destroy
that app, loop etc.

Turning bug reports into test cases causes regressions to be noticed
quicker I would think.- Hide quoted text -

 - Show quoted text -


[web2py] Re: Behaviour of extend/layouts changed in 1.82.1?

2010-08-14 Thread Paul Gerrard
Heres my solution - works a treat:

#Controller.py
if request.vars.get('printMode', None):
response.layout = 'layoutPrint.html'
printMode=True
else:
response.layout = 'layout.html'
printMode=False


# all views
{{extend response.layout}}

I use the printMode Boolean to detemine whether to display the
Printer Friendly link on the page.

Many thanksThadeus.


On Aug 13, 11:07 pm, Paul Gerrard p...@gerrardconsulting.com wrote:
 I suspected that I had done something that worked 'by chance' and the
 new version caught me out. :)

 Thanks for the tip - I'll try it.

 Paul G

 On Aug 13, 5:30 pm, Thadeus Burgess thade...@thadeusb.com wrote:



  Odd... it should *technically* extend from the last seen version of
  extend regardless of where it is located.

  Also, I don't understand how this worked pre 1.80 either.

  The templates are parsed before any of the python statements are even
  known or executed, this just should have never worked.

  I also don't see an obvious way of making this work, since the
  template would have to know the context of python as its parsing.

  Try re-designing how you handle this.

  in controllers.py or models.py
  # Just assign a variable to the name of the template you want to extend
  response.printMode = 'layoutPrint.html' if
  request.vars.get('printMode', None) else 'layout.html'

  in templates.py
  {{extend response.printMode}}

  --
  Thadeus

  On Fri, Aug 13, 2010 at 10:31 AM, Paul Gerrard

  p...@gerrardconsulting.com wrote:
   Hi,

   I have a lot of views in my system with the following code at the top
   of the view html:

   {{import string}}

   {{if request.vars and 'printMode' in request.vars:}}
   {{printMode=request.vars['printMode']}}
   {{else:}}
   {{printMode=None}}
   {{pass}}

   {{if printMode:}}
   {{extend 'layoutPrint.html'}}
   {{else:}}
   {{extend 'layout.html'}}
   {{pass}}

   ... the rest of the layout HTML etc.

   In version 1.79.1 it worked fine. If there was no printMode var in the
   query string, I got the standard layout. If there was a PrintMode var,
   I got a simpler layout without the headers, menus etc. for printing..

   In 1.82.1 it doesn't work at all. It looks like neither layout is
   invoked and all my pages look terrible with no formatting (because no
   CSS) at all.

   Any suggestions (or I'll ave to regress back to 1.79.1). :O(- Hide quoted 
   text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -


[web2py] Behaviour of extend/layouts changed in 1.82.1?

2010-08-13 Thread Paul Gerrard
Hi,

I have a lot of views in my system with the following code at the top
of the view html:

{{import string}}

{{if request.vars and 'printMode' in request.vars:}}
{{printMode=request.vars['printMode']}}
{{else:}}
{{printMode=None}}
{{pass}}

{{if printMode:}}
{{extend 'layoutPrint.html'}}
{{else:}}
{{extend 'layout.html'}}
{{pass}}

... the rest of the layout HTML etc.

In version 1.79.1 it worked fine. If there was no printMode var in the
query string, I got the standard layout. If there was a PrintMode var,
I got a simpler layout without the headers, menus etc. for printing..

In 1.82.1 it doesn't work at all. It looks like neither layout is
invoked and all my pages look terrible with no formatting (because no
CSS) at all.

Any suggestions (or I'll ave to regress back to 1.79.1). :O(


[web2py] Re: Behaviour of extend/layouts changed in 1.82.1?

2010-08-13 Thread Paul Gerrard
I suspected that I had done something that worked 'by chance' and the
new version caught me out. :)

Thanks for the tip - I'll try it.

Paul G


On Aug 13, 5:30 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 Odd... it should *technically* extend from the last seen version of
 extend regardless of where it is located.

 Also, I don't understand how this worked pre 1.80 either.

 The templates are parsed before any of the python statements are even
 known or executed, this just should have never worked.

 I also don't see an obvious way of making this work, since the
 template would have to know the context of python as its parsing.

 Try re-designing how you handle this.

 in controllers.py or models.py
 # Just assign a variable to the name of the template you want to extend
 response.printMode = 'layoutPrint.html' if
 request.vars.get('printMode', None) else 'layout.html'

 in templates.py
 {{extend response.printMode}}

 --
 Thadeus

 On Fri, Aug 13, 2010 at 10:31 AM, Paul Gerrard



 p...@gerrardconsulting.com wrote:
  Hi,

  I have a lot of views in my system with the following code at the top
  of the view html:

  {{import string}}

  {{if request.vars and 'printMode' in request.vars:}}
  {{printMode=request.vars['printMode']}}
  {{else:}}
  {{printMode=None}}
  {{pass}}

  {{if printMode:}}
  {{extend 'layoutPrint.html'}}
  {{else:}}
  {{extend 'layout.html'}}
  {{pass}}

  ... the rest of the layout HTML etc.

  In version 1.79.1 it worked fine. If there was no printMode var in the
  query string, I got the standard layout. If there was a PrintMode var,
  I got a simpler layout without the headers, menus etc. for printing..

  In 1.82.1 it doesn't work at all. It looks like neither layout is
  invoked and all my pages look terrible with no formatting (because no
  CSS) at all.

  Any suggestions (or I'll ave to regress back to 1.79.1). :O(- Hide quoted 
  text -

 - Show quoted text -


[web2py] Ajax works differently in IE and Firefox

2010-07-23 Thread Paul Gerrard
Hi,

I have a view that displays rows of data, each of which a form that
can be edited (passed in an array). Each row has (among other fields),
two SELECT lists. The values displayed in the second list depend on
the first.

I use Ajax to refresh the second list if the first one changes.

Using IE 8 on Windows - it works absolutely fine. The right elements
are listed in the second list and the update saves the correct
references for both list.

Using Firefox, the ajax function workd fine. Changing the first list
makes the second list refresh correctly. However, when I select a
value in the second list, and save - the record is saved but the
second value is always stored as zero. (Changing a value in the second
list without changing the fuirst works fine of course!)

I'm stumped. Can't find anything on the list or the wider itnernet on
this topic. Have I missed something obvious here? Is there a way of
forcing Firefox to behave the same way as IE? Is IE working because it
is buggy and Firefox behaves correctly? ??



[web2py] Problems changing table definition

2010-07-21 Thread Paul Gerrard
Hi,

I'm having great problems changing the definition of a table. I'm
using MYSQL as a back end. After many problems, I ended up deleting a
table entirely and trying to recreate it in my DB model. I dropped the
table from MYSQL directly and tried to use the new model.

Unfortunately, I get a message: table doesn't exist when I try and
use it. It looks like Web2py remembers the table and tried to update
what it remembers. Can this 'remembered DB' be cleared out so I can
start again? I only want to change on table (and not lose all my
tables :-))

Thanks,
Paul.


[web2py] Re: Problems changing table definition

2010-07-21 Thread Paul Gerrard
An updqate.

I read the manual 6.4 on Migrations. I've added a migrate='tablename'
aramter to the table definition call. It seems to work.

So I guess I've disconnected the table definition from the Web2py
table history. So far so good.

So I have a more general point.

Is it 'better' to manage database designs using the Web2py model or
better to manage the database using the DB utilities and keep the
model in sync? I understand the web2py model route ought to be
better, but this is the second time I've lots hours messing around
with out of sync database and models.



[web2py] Re: Problems changing table definition

2010-07-21 Thread Paul Gerrard
Thanks - I already do nightly backups of data and code (been stung too
many times before).

I want to use Web2p as you say, but I've had problems in the past. 2-3
times, no matter what I've tried, I couldn't edit the DB.py file and
avoid crashes. Ended up deleting tables, massaging data with MS
Access, recreataing with difference nemae and reocdign etc. etc.

Also, I can't point the app at an empty MySQL database and let it
build the tables. Have to rely on a backup to recreate empty tables
first. I haven't kept any evidence, but I will post it here next time
(if it happens again). Have you had problems with MySQL users
before???

Really enjoying using Web2py - I'm building a test support/management
tool to support our business services. Very happy with the development
progress and just a few niggles - this is one of them. Working through
others...

Thanks again.

On Jul 21, 11:07 am, mdipierro mdipie...@cs.depaul.edu wrote:
 It is better to always use web2py but remember to use (default)
 migrate=True every time you edit the db.
 You may also want to keep a backup of your database/*.tables

 On Jul 21, 4:54 am, Paul Gerrard p...@gerrardconsulting.com wrote:



  An updqate.

  I read the manual 6.4 on Migrations. I've added a migrate='tablename'
  aramter to the table definition call. It seems to work.

  So I guess I've disconnected the table definition from the Web2py
  table history. So far so good.

  So I have a more general point.

  Is it 'better' to manage database designs using the Web2py model or
  better to manage the database using the DB utilities and keep the
  model in sync? I understand the web2py model route ought to be
  better, but this is the second time I've lots hours messing around
  with out of sync database and models.- Hide quoted text -

 - Show quoted text -


[web2py] Re: does anybody know what happened to www.web2pyslices.com?

2010-06-10 Thread Paul Gerrard
Hi,

If you want a new ISP - I have four under used servers that I'm happy
to offer as a host for the site for free if you want. I currently host
around 30 (several are mine, most for friends, all for free) websites
with ASP, Perl, PHP, MySQL, Sharepoints, SQL Server and of course my
own Web2py developments. Currently all Windows 2003/2008, but I'm
thinking of setting up an Ubuntu server for the Web2py-based test
management tool I'm developing and my various Drupal web sites.

Just a thought :-)

Paul.

On Jun 9, 9:32 am, mr.freeze nat...@freezable.com wrote:
 My VPS provider is having some major problems. I'm going to move it
 tomorrow if they can't resolve. It should be back up within a day.

 On Jun 9, 2:24 am, José L. jredr...@gmail.com wrote:



  It's not reachable since a couple of days, and it's a very valuable
  tool for web2py users...

  José L.- Hide quoted text -

 - Show quoted text -


[web2py] Emails lack the From: header

2010-06-07 Thread Paul Gerrard
Hi,

Using  the auth/email functionality. I use the code below (extracted
from my default.py controller) and executing testmail function send
emails but it appears not to set up the From:... header in the
message. When the email arrives in my inbox, Outlook put the message
striaght into the junk folder, because it can't identify the sender.
(The same problem occurs with the user registration process).

I've used some Python code and the smtplib code to send emails with
the same params and a From header and it works fine).

Am I doing something wrong here? A bug?

Suggestions gratefully received.

Many thanks,
Paul.

 start 

from gluon.tools import Auth
from gluon.tools import Mail


auth = Auth(globals(), db)
auth.define_tables()
# auth.settings.actions_disabled.append('register')

mail = Mail(globals())
mail.settings.server = 'localhost:25'
mail.settings.sender = 'ad...@mytestportal.com'
auth.settings.mailer = mail

def testmail():
 
auth.settings.mailer.send('p...@gerrardconsulting.com','hello','Test
Message',reply_to='ad...@mytestportal.com')

return dict(mailer=auth.settings.mailer)

+++ end +++


[web2py] Re: Emails lack the From: header

2010-06-07 Thread Paul Gerrard
Hi,

Ahh - I'm on 1.76.5 - I'll upgrade and watch out for that next time.
Sorry.

Paul.

On Jun 7, 2:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 This was fixed in 1.78.3. Do you have an earlier version?

 On Jun 7, 2:11 am, Paul Gerrard p...@gerrardconsulting.com wrote:



  Hi,

  Using  the auth/email functionality. I use the code below (extracted
  from my default.py controller) and executing testmail function send
  emails but it appears not to set up the From:... header in the
  message. When the email arrives in my inbox, Outlook put the message
  striaght into the junk folder, because it can't identify the sender.
  (The same problem occurs with the user registration process).

  I've used some Python code and the smtplib code to send emails with
  the same params and a From header and it works fine).

  Am I doing something wrong here? A bug?

  Suggestions gratefully received.

  Many thanks,
  Paul.

   start 

  from gluon.tools import Auth
  from gluon.tools import Mail

  auth = Auth(globals(), db)
  auth.define_tables()
  # auth.settings.actions_disabled.append('register')

  mail = Mail(globals())
  mail.settings.server = 'localhost:25'
  mail.settings.sender = 'ad...@mytestportal.com'
  auth.settings.mailer = mail

  def testmail():

  auth.settings.mailer.send('p...@gerrardconsulting.com','hello','Test
  Message',reply_to='ad...@mytestportal.com')

      return dict(mailer=auth.settings.mailer)

  +++ end +++- Hide quoted text -

 - Show quoted text -