[web2py:36958] Re: Validation when using crud.create

2009-12-10 Thread annet
Massimo,

 I think you mean

 db.companyactivity.company.requires=[IS_IN_DB(db,db.company.id,'%
 (companyname)s'),IS_NOT_IN_DB(db
 (db.companyactivity.activity==request.vars.activity),db.companyactivity.company,error_message='already
 in database')]

Yes, I am sorry a typo introduced on translation.

The problem still exists, in appadmin all the validators of this kind
work, in my own cms based on crud
functions they do not work.

Annet

--

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




[web2py:37024] Re: Custom Form Element For Crud.Create

2009-12-11 Thread annet
Hi Mengu,

 i was just wondering if it is possible to add a custom form element
 like an input or a drop down box to a crud.create. i also would like
 to know how sqlform is different than crud.

I don't know if this what you're looking for, but I needed a custom
drop
box in a crud.create and a crud.update form, I added the following
line
to the function:

activity=activity_rowset()
db.timetable.activity.requires=IS_IN_SET([row.activity for row in
activity])

The entire function reads like:

@auth.requires_membership('site_manager')
def create_timetable():
response.view='default/form.html'
response.flash='Insert class'
db.timetable.company.default=auth.user.company
activity=activity_rowset()
db.timetable.activity.requires=IS_IN_SET([row.activity for row in
activity])
form=create_form(db.timetable,message='Class inserted')
return dict(form=form)


create_form is a custom function in which I add a reset and canel
button to
the from, I guess that answers the first part of your question:

def create_form(table,message):
form=crud.create(table,message=message)
form[0][-1][1].append(INPUT(_type=reset,_value=Reset))
form[0][-1][1].append(INPUT
(_type=button,_value=Cancel,_onclick=javascript:history.go(-1)))
return form


I hope this will point you in the right direction.

Annet.

--

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




[web2py:37038] Re: validator less than

2009-12-11 Thread annet
Massimo,

 Why isn't the problem solved by the validator that I posted?

In my model the openinghours table reads like:

db.define_table('openinghours',
Field
('company',db.company,default='',notnull=True,ondelete='CASCADE',
writable=False, readable=False),
Field('day',db.day,default='',notnull=True,ondelete='RESTRICT'),
Field('from_tijd',type='time',default='',notnull=True),
Field('to_tijd',type='time',default='',notnull=True),
migrate='openinghours.table')

...
db.openinghours.from_time.requires=IS_TIME(error_message='should be
UU:MM!')
db.openinghours.from_time.widget=timeplain
db.openinghours.from_time.requires=is_less_than(request.vars.to_time)
db.openinghours.to_time.requires=IS_TIME(error_message='should be
UU:MM!')
db.openinghours.to_time.widget=timeplain

In the less_than_class I changed the following line, because of the
format of the
opening hours:

other=datetime.datetime.strptime(self.value,'%H:%M')

When I expose the functions that create or update opening hours, I get
an error ticket:

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py,
line 184, in restricted
exec ccode in environment
  File /Library/Python/2.5/site-packages/web2py/applications/cms/
controllers/services.py, line 224, in module
  File /Library/Python/2.5/site-packages/web2py/gluon/globals.py,
line 103, in lambda
self._caller = lambda f: f()
  File /Library/Python/2.5/site-packages/web2py/gluon/tools.py, line
1644, in f
return action(*a, **b)
  File /Library/Python/2.5/site-packages/web2py/applications/cms/
controllers/services.py, line 34, in update_openinghour
form=update_form
(db.openingstijd,record,'crud_openinghour','Openingstijd
gewijzigd',True)
  File /Library/Python/2.5/site-packages/web2py/applications/cms/
models/db.py, line 703, in update_form
form=crud.update(table,record,next=(URL
(r=request,f=next)),message=message,deletable=deletable)
  File /Library/Python/2.5/site-packages/web2py/gluon/tools.py, line
2040, in update
keepvalues=self.settings.keepvalues):
  File /Library/Python/2.5/site-packages/web2py/gluon/sqlhtml.py,
line 765, in accepts
onvalidation,
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
1269, in accepts
status = self._traverse(status)
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
453, in _traverse
newstatus = c._traverse(status) and newstatus
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
453, in _traverse
newstatus = c._traverse(status) and newstatus
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
453, in _traverse
newstatus = c._traverse(status) and newstatus
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
453, in _traverse
newstatus = c._traverse(status) and newstatus
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
460, in _traverse
newstatus = self._validate()
  File /Library/Python/2.5/site-packages/web2py/gluon/html.py, line
1078, in _validate
(value, errors) = validator(value)
  File /Library/Python/2.5/site-packages/web2py/applications/cms/
models/db.py, line 28, in __call__
other=datetime.datetime.strptime(self.value,'%H:%M')
TypeError: strptime() argument 1 must be string, not None

I don't understand why argument 1 is None.

 If you want to compare from_time with to_time then to_time should bot
 be None unless you tell us how should the validation be performed in
 this case.

When the user enters from_time 10:00 and to_time 22:00 the form should
be accepted,
10:00  22:00 is True
When the user enters from_time 10.00 and to_time 02:00 the form should
NOT be accepted.
10:00  02:00 is False.

I hope this explanation of my problem helps you help me solve it.

Annet.

--

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




[web2py:37040] validator breaks update and create other table

2009-12-11 Thread annet
In my model I have a combination table that combines companies with
activities. Since I don't want a user to enter a combination twice I
defined the following validator:

db.companyactivity.company.requires=[IS_IN_DB(db,db.company.id,'%
(companyname)s'),IS_NOT_IN_DB(db
(db.companyactivity.activity==request.vars.activity),db.companyactivity.company,error_message='already
in database')]


I also have a table timetable which reads like:

db.define_table('timetable',
Field
('company',db.company,default='',notnull=True,ondelete='CASCADE',
writable=False, readable=False),
Field('activity',length=48,default='',notnull=True),
Field('day',db.dag,default='',notnull=True,ondelete='RESTRICT'),
Field('time',type='time',default='',notnull=True),
Field('duration',length=3,default='',notnull=True),
Field('location',length=24),
Field
('level',db.level,default=1,notnull=True,ondelete='RESTRICT'),
migrate='timetable.table')

In my cms the function to insert a class or update a class reads like:

@auth.requires_membership('site_manager')
def create_timetable():
response.view='default/form.html'
response.flash='Insert class'
db.timetable.company.default=auth.user.company
activity=activity_rowset()
db.timetable.activity.requires=IS_IN_SET([row.activity for row in
activity])
form=create_form(db.timetable,message='Class inserted')
return dict(form=form)

@auth.requires_membership('site_manager')
def update_timetable():
response.view='default/form.html'
response.flash='Update or delete class'
record=db.timetable[request.args[0]]
if not record or not record.company==auth.user.bedrijf:
redirect(URL(r=request,f='crud_timetable'))
activity=activity_rowset()
db.timetable.activity.requires=IS_IN_SET([row.activity for row in
activity])
form=update_form(db.timetable,record,'crud_timetable','Class
deleted or updated',True)
return dict(form=form)

When I expose these function I get the following error ticket:

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py,
line 184, in restricted
exec ccode in environment
  File /Library/Python/2.5/site-packages/web2py/applications/cms/
models/db.py, line 293, in module
db.bedrijfactiviteit.bedrijf.requires=[IS_IN_DB(db,db.bedrijf.id,'%
(bedrijfsnaam)s'),IS_NOT_IN_DB(db
(db.bedrijfactiviteit.activiteit==request.vars.activiteit),db.bedrijfactiviteit.bedrijf,error_message='combinatie
bedrijf en activiteit al in database')]
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
2310, in __eq__
return Query(self, '=', value)
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
2688, in __init__
right = sql_represent(right, left.type, left._db._dbname)
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
466, in sql_represent
return str(int(obj))
ValueError: invalid literal for int() with base 10: 'BodyCircuit'


When I remove the validator from the companyactivity table, both
functions work for the timetable table work. I don't see the
connection between the validator and the two functions, therefore I
don't understand why this error occurs. Does one of you know why this
happens?

Kind regards,

Annet.

--

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




[web2py:37078] Re: validator breaks update and create other table

2009-12-12 Thread annet
Massimo,

 (db.companyactivity.activity==request.vars.activity)

 the left hand side a reference field or an int and the right hand side
 is a string. Hard to follow ...

I apologize for that. The combination table reads like:

db.define_table('companyactivity',
Field
('company',db.company,default='',notnull=True,ondelete='CASCADE',
writable=False, readable=False),
Field
('activity',db.activity,default='',notnull=True,ondelete='RESTRICT'),
Field('created_on',type='datetime', writable=False,
readable=False),
Field('modified_on',type='datetime', writable=False,
readable=False),
migrate='companyactivity.table')

db.companyactivity.company.requires=[IS_IN_DB(db,db.company.id,'%
(companyname)s'),IS_NOT_IN_DB(db
(db.companyactivity.activity==request.vars.activity),db.companyactivity.company,error_message='already
in database')]
db.companyactivity.activity.requires=IS_IN_DB(db,db.activiteit.id,'%
(activiteit)s')


So company and activity are both of type int.


 db.timetable.activity.requires=IS_IN_SET([row.activity for row in
 activity])

 should be

 db.timetable.activity.requires=IS_IN_SET([row.id for row in activity],
 [row.activity for row in activity])

I changed my code to read like the code above, but I still get the
same error ticket.


Kind regards,

Annet.

--

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




[web2py:37083] Re: crud.update(...,message,...)

2009-12-12 Thread annet
Massimo,

Is there a way to solve this problem?


Kind regards,

Annet.

--

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




[web2py:37095] Re: crud.update(...,message,...)

2009-12-12 Thread annet
Massimo,

 I am not sure I understand the problem. Let me assume you want the
 message displayed after redirection. In this case you need to use

 crud.update(...,message='')

 and message will be displayed after redirection.

The message didn't display after redirection because it was overridden
by
another response.flash, I had to rename one of the flashes to get the
flash
to work properly.

Thanks for pointing me in the right direction.

Annet.

--

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




[web2py:37224] Hosting at Webfaction

2009-12-15 Thread annet
I am planning to sign up for a Plan Shared 1 hosting account at
WebFaction for production purposes. So far, I have been developing an
application on my Mac, on which the web2py source code runs out of the
box, and testing it on a Mac Server which I access using Apple Remote
DeskTop. I read the post below, and wonder whether there have been any
changes since it was posted. Further more I have some questions about
it. Step 1 to 3 are clear to me. However, step 4 is a bit cryptic to
me:


Get the latest web2py and copy it into ~/webapps/apachewsgi/:
cd ~/repos/svn #for example
svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-
only
svn export web2py-read-only ~/webapps/apachewsgi/web2py

Do I access my account using SSH and run these commands?


cd ~/repos/svn #for example

Means change directory to ~/repos/svn why '# for example'?


svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-only

Here I get the latest copy of web2py? Why web2py-read-only?


svn export web2py-read-only ~/webapps/apachewsgi/web2py

... and copy it into ~/webapps/apachewsgi/ why ~/webapps/apachewsgi/
web2py?


On my Mac Server I uploaded the web2py source code from my Mac into my
home folder using sftp and opened web2py_src.zip using the archive
utility, can't I do something similar at WebFaction?


Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:

How do I do that at WebFaction do they provide a texteditor in which
you open the httpd.conf file?


from another terminal, kill web2py process according to web2py's
output instructions

Start your app:
~/webapps/apachewsgi/apach2/bin/start

Here I am completely lost:

from another terminal, kill web2py process according to web2py's
output instructions

What does that mean?


I am apologies for asking so many questions about something as simple
as setting up web2py at WebFaction, but I really haven't got a clue
what some of the instructions are about.


Kind regards,

Annet.


Settting up Web2py as WSGI on Webfaction

Make available two subdomain names, one for adminstration, the other
for public display:
'admin.example.com'
'www.example.com'

Create a webfaction application of type mod_wsgi 2.0/Python 2.5:
'apachewsgi'

Create two webfaction sites that :
'mysite_admin' -- https enabled; subdomain 'admin.example.com';
application 'apachewsgi' served at '/'

'mysite' -- *not* https enabled; subdomain 'www.example.com';
application 'apachewsgi' served at '/'

Get the latest web2py and copy it into ~/webapps/apachewsgi/:
cd ~/repos/svn #for example
svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-
only
svn export web2py-read-only ~/webapps/apachewsgi/web2py

Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:
see listing below

in the httpd.conf file, the port number for the app is in line:
Listen 

Create admin password:
in ~/webapps/apachewsgi/web2py:
python2.5 web2py -p   # where  is port number, no
quotes

web2py will ask you for a password, which it will then store in a
file, 'parameters_.py'

from another terminal, kill web2py process according to web2py's
output instructions

Start your app:
~/webapps/apachewsgi/apach2/bin/start

Have fun ?



=  START httpd.conf listing  ==

ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so

# above 6 are added by webfaction; I added mod_alias and mod_access
LoadModule alias_module modules/mod_alias.so
LoadModule access_module modules/mod_access.so

KeepAlive Off
Listen 

WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
wsgihandler.py
WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
 home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
 processes=1 maximum-requests=1000

NameVirtualHost 127.0.0.1:
VirtualHost 127.0.0.1:
ServerName www.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
/Directory
/VirtualHost

VirtualHost 127.0.0.1:
ServerName admin.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications/admin
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order

[web2py:37372] Re: Hosting at Webfaction

2009-12-16 Thread annet
Massimo,

Since I am a complete novice when it comes to working with computers
other than a Mac, I guess it might be helpful to share the knowledge I
acquired along the way with others. I will post a slice when I have
set up the entire account.

For now, David, of WebFaction Support, mailed me that for https a
dedicated IP address is required and that additionally this allows me
to open custom ports. To get a dedicated IP address you first need to
sign up for a Shared 1 plan and then upgrade it through the control
panel to a Shared 1 with dedicated IP address.


Furthermore he told me to change my domain's NS records to use their
nameservers.

ns1.webfaction.com
ns2.webfaction.com
ns3.webfaction.com
ns4.webfaction.com


I am not sure all this is absolutely necessary, I'd like to learn that
from you.


Mengu,

Thanks for your explantion.


Kind regards,

Annet

--

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




[web2py:37509] unique=True unexpected behaviour.

2009-12-18 Thread annet
I defined the following table:

db.define_table('paymentdata',
Field
('company',db.company,default='',notnull=True,ondelete='CASCADE',unique=True),
Field('account',length=10,default='',notnull=True),
Field('BIC',length=8,default='',notnull=True),
Field('IBAN',length=34,default='',notnull=True),
Field('VAT',length=24,default='',notnull=True),
Field('created_on',type='datetime',writable=False,readable=False),
Field
('modified_on',type='datetime',writable=False,readable=False),
migrate='paymentdata.table')

db.paymentdata.company.requires=[IS_IN_DB(db,db.company.id,'%
(companyname)s'),IS_NOT_IN_DB(db,'company.id',error_message=T
('paymentdata already in database'))]


The user shouldn't be able to enter paymentdata more than once, I
thought by making company unique and defining the validator I would
implement that constraint. However, even when inserting a record in an
empty paymentdata table I get the error message ' paymentdata already
in database'. Why?


Kind regards,

Annet

--

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




[web2py:37751] a onclick=javascript: ... problem

2009-12-23 Thread annet
In one of my views (http://127.0.0.1:8000/frame/default/index) I have
the following link:

a class=adiv href={{=URL(r=request,c='demo',f='index')}}
  h2Fitwise Demo Applicatie/h2
  pIn de Demo Applicatie .../p
/a !-- adiv --


It renders the whole div as a link, and works. Since I would like the
url to open in its
own window I replaced the url with the following code. In the view:


a class=adiv onmouseover=this.style.cursor='pointer';
onclick=javascript:demo('%s')%URL(r=request,c='demo',f='index')
  h2Fitwise Demo Applicatie/h2
  pIn de Demo Applicatie .../p
/a !-- adiv --


... and in the _ajax.html file:


function demo(url) {
demowindow=window.open
(url,'name','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=800,height=700');
  if (window.focus) demowindow.focus();
  return false;
}


When I click the div, a new window opens, however, the url reads like:

http://127.0.0.1/frame/default/%s

whereas, it should read like:

http://127.0.0.1:8000/frame/demo/index

Why doesn't this work?


Kind regards,

Annet.

--

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




[web2py:37765] Re: a onclick=javascript: ... problem

2009-12-23 Thread annet
Massimo and Jonathan,

 I do not why but why not just

 a class=adiv href={{=URL(r=request,c='demo',f='index')}}
 target=demo

Thanks, that solves my problem in this case, because I don't need to
re-size the window.


Maybe because you never escape your Python code?

td
  {{=A
(club.bedrijf.bedrijfsnaam,_onmouseover=this.style.cursor='pointer';,
\
  _onclick=javascript:clublocatordetails('%s')%URL
(r=request,f='details',args=[club.bedrijf.id]))}}
/td

I based my code on the lines of code above. However, since I don't
think I could replace:

club.bedrijf.bedrijfsnaam

with:

h2Fitwise Demo Applicatie/h2
pIn de Demo Applicatie .../p

I gave this a try:

a class=adiv onmouseover=this.style.cursor='pointer';
onclick=javascript:demo('%s')%URL(r=request,c='demo',f='index')
  h2Fitwise Demo Applicatie/h2
  pIn de Demo Applicatie .../p
/a !-- adiv --

By escaping my Python code you mean escaping this line:

onclick=javascript:demo('%s')%URL(r=request,c='demo',f='index')

... how would I do that?


Kind regards,

Annet.

--

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




[web2py:37806] Re: Happy Holidays

2009-12-24 Thread annet
All of you,

Thanks for all the helpful replies to my posts, I really learned a
lot.

Merry Christmas and all the best for 2010.


Annet.

--

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




[web2py:37808] Cron job at WebFaction

2009-12-24 Thread annet
In the WebFaction documentation about creating an application, I read
the following line:

If the application is a long-running process, the control panel
installer also adds a cron job which periodically restarts the process
if it stops running.

Since there is no control panel installer for web2py I guess this
doesn't apply to web2py. Is there a way to add a similar cron job for
web2py at WebFaction?


Kind regards,

Annet

--

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




[web2py:37810] Re: Hosting at Webfaction

2009-12-24 Thread annet
In step two of the set up instructions reads like:

Create a webfaction application of type mod_wsgi 2.0/Python 2.5:
'apachewsgi'

Why an application of  type: 'mod_wsgi 2.0 python 2.5' and not an
application of type: 'Custom app (listening on port)?


As described in the FAQ section of the WebFaction site:

How do I install an application that is not in the control panel

Custom app (listening on port) - use this when your application is a
long-running process that listens on a network port. Installing this
type of application reserves a port number on which you can run your
app, and creates a subdirectory, under $HOME/webapps, where you can
put the application's files. For this type of app, it's not necessary
to put the files in that location; as long as your application is
configured to run on the assigned port, you can run it from whatever
directory you'd like.


Kind regards,

Annet.

--

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




[web2py:37833] Re: Cron job at WebFaction

2009-12-25 Thread annet
Andy,

I think your guess is right, to be sure I asked support the same
question. Here is their answer:


There is a Control Panel installer for 'mod_wsgi 2.5/Python 2.5' - it
automatically creates a cron job that would start the server, if it is
not running.


I guess 'the server' refers to web2py? What exactly is a cron job in
this case?


Kind regards,

Annet.


--

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




[web2py:37849] files under a subdomain.

2009-12-26 Thread annet
My applications have a number of files in common which I would like to
store under a subdomain:
e.g. files.example.com

At the moment I store these files in the static folders of the
applications and use the following URLs to retrieve them:

in web2py_ajax:

response.files.insert(0,URL(r=request,c='static',f='jquery.js'))

in a custom controller:

response.image=URL(r=request,c='static',f='cms/media/default_1.jpg')

Is it possible to store the .js .css and .jpg files under
files.example.com, if so, where on the server should I store them and
what would the URLs in the applications read like?


Kind regards,

Annet


--

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




[web2py:37851] Add buttons to form=auth() form

2009-12-26 Thread annet
I would like to add a reset and cancel button to the form in the def
user(): function.

I tried:

def user():
form=form=auth()
form[0][-1][1].append(INPUT(_type=reset,_value=Reset))
form[0][-1][1].append(INPUT
(_type=button,_value=Cancel,_onclick=window.location='%s';%URL
(r=request,f='index')))
return form


... but that doesn't work. What is the correct way to add these
buttons to this form?


Kind regards,

Annet.

--

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




[web2py:37857] Sending mail from application.

2009-12-26 Thread annet
After upgrading from 1.72.3 to 1.74.4 sending mail from my application
no longer works. I get the following error ticket:

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py,
line 173, in restricted
exec ccode in environment
  File /Library/Python/2.5/site-packages/web2py/applications/init/
controllers/utility.py, line 72, in module
  File /Library/Python/2.5/site-packages/web2py/gluon/globals.py,
line 96, in lambda
self._caller = lambda f: f()
  File /Library/Python/2.5/site-packages/web2py/applications/init/
controllers/utility.py, line 64, in contact
mail.send(to=['vermee...@xs4all.nl'], subject=form.vars.onderwerp,
message=form.vars)
  File /Library/Python/2.5/site-packages/web2py/gluon/tools.py, line
282, in send
text = text.read().decode(encoding).encode('utf-8')
TypeError: 'NoneType' object is not callable


The function reads like:

def contact():
form=SQLFORM.factory(SQLField('bedrijfsnaam'),
SQLField(...),
SQLField('onderwerp',label='Onderwerp *',requires=IS_NOT_EMPTY()),
SQLField('bericht',type='text',label='Uw bericht
*',requires=IS_NOT_EMPTY()))
form[0][-1][1].append(INPUT(_type='reset',_value='Reset'))
form[0][-1][1].append(INPUT
(_type='button',_value='Cancel',_onclick='javascript:history.go(-1)'))
if form.accepts(request.vars,session):
response.flash='Het formulier is verzonden, u ontvangt binnen
5 werkdagen een reactie'
mail.send(to=['an...@gmail.com'], subject=form.vars.onderwerp,
message=form.vars)
form=[]
elif form.errors:
response.flash=response.flash_error
else:
response.flash='de velden gemerkt met een * zijn verplichte
velden'
return dict(form=form)

Since it did work in version 1.72.3 I guess this has something to do
with differences between versions.


Kind regards,

Annet

--

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




[web2py:37867] Re: Sending mail from application.

2009-12-26 Thread annet
Massimo,

 This line

         mail.send(to=['an...@gmail.com'], subject=form.vars.onderwerp,
 message=form.vars)

 should never have worked as far as I can tell. form.vars is a Storage
 object, not a string, as a message should be.

It did in previous versions of web2py. I received the form as an e-
mail with the
subject set to form.vars.onderwerp and the vars as field value pairs
as the
message.

Is there a way to send a contact form (19 Field including a text area
from the application to an e-mail address?

Kind regards,

Annet.

--

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




[web2py:37868] Re: Sending mail from application.

2009-12-26 Thread annet
Massimo,

This is how it does work:

message='%(bedrijfsnaam)s\
%(aanhef)s %(initialen)s %(voorvoegsel)s %(achternaam)s %
(straat)s %(huisnummer)s %(postcode)s\
%(plaats)s %(email)s %(telefoonnummer_contact)s %(bericht)s'
%form.vars


Annet.

--

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




[web2py:37879] Re: Add buttons to form=auth() form

2009-12-27 Thread annet
Massimo,

 What do you mean by doesn't work? You do not see the buttons?

Yes.

 Try this:

 def user():
     form=auth()
     form[0][-1][1].append(INPUT(_type=reset,_value=Reset))
     form[0][-1][1].append(INPUT
 (_type=button,_value=Cancel,_onclick=window.location='%s';%URL
 (r=request,f='index')))
     return dict(form=form)

Thanks return dict (form=form) solved the problem.


Kind regards,

Annet.

--

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




[web2py:37880] Confirmation at delete

2009-12-27 Thread annet
The jQuery code for confirmation on delete connects the onclick event
of the checkbox with a confirmation dialog, I have never seen this
convention before, in the applications I have seen sofar the
confirmation dialog is triggered by a submit. Is it possible to re-
write the code in web2py_ajax.html:


jQuery(input[type='checkbox'].delete).click(function() { if
(this.checked) if(!confirm({{=T('Sure you want to delete this
object?')}})) this.checked=false; });


... so that the code connects the submit with the confirmation dialog
and not the onclick event of the checkbox?


Kind regards,

Annet.

--

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




[web2py:37881] Re: files under a subdomain.

2009-12-27 Thread annet
Massimo,

 yes but you will need to hardcode the URLs instead of using URL(...).

So the URLs in web2py_ajax and the custom controller would read like:

  response.files.insert(0,URL(r=request,c='static',f='jquery.js'))

response.files.insert(0,'http://files.example.com/js/jquery.js')


  response.image=URL(r=request,c='static',f='cms/media/default_1.jpg')

response.image='http://files.example.com/cms/media/default_1.jpg'


I guess to stay away from hard coding the URLs I could also create a
files application and
serve the files from there?

Kind regards,

Annet.

--

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




[web2py:37883] WSGI and wsgihandler.py

2009-12-27 Thread annet
I am working my way through setting up my account at Webfaction using
the WebFaction and web2py User Guides and this post:
http://forum.webfaction.com/viewtopic.php?pid=8844#p8844

Since this post is almost a year old, and web2py has evolved rapidly,
I wonder whether the procedure is still accurate. e.g. I created a
mod_wsgi 2.5/Python 2.5 application and got the following
confirmation:

Created by me on 2009-12-24 09:49:41, modified by me on 2009-12-24
09:49:41
Name:   apachewsgi
Port:   x
App type:   mod_wsgi 2.5/Python 2.5
App doc:

This sets up the mod_wsgi 2.5/Python 2.5 stack.
Apache will be installed in your application's apache2 directory.
A cronjob that runs every 20 minutes and restarts Apache if it's down
will be created.

Plus the installer for 'mod_wsgi 2.5/Python 2.5' -  automatically
creates a cronjob that would start the server, if it is not running.

So I have Apache installed and a mod_wsgi 2.5/Python 2.5. application,
which I guess is WSGI as referenced in the following line:

In the web2py user guide I read: web2py provides a file wsgihandler.py
to interface to WSGI.

What exactly does this mean, and does it have any consequences for the
httpd.conf file?


Kind regards,

Annet.

--

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




[web2py:37885] Re: Hosting at Webfaction

2009-12-27 Thread annet
Hi Mengu,

 so basically, you need to fire up another terminal window to ssh into
 your webfaction account and use kill -SIGTERM 9813. that's what it
 means.

I thought web2py is a long running process but from these
instructions:

from another terminal, kill web2py process according to web2py's
output instructions

Start your app:
~/webapps/apachewsgi/apach2/bin/start


... I learn that I kill web2py and start apache? Is that right.

On my Mac Server I used Screen Sharing to start web2py, and run web2py
as a long running process, that is, I didn't 'kill' it. How does that
work at WebFaction
is web2py started everytime there is a request an then stopped?

Kind regards,

Annet.

--

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




[web2py:37896] Re: Confirmation at delete

2009-12-27 Thread annet
Massimo,

I am a complete novice when it comes to programming in Python.
Maybe one of the group members could provide a patch?

Kind regards,

Annet

--

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




[web2py:37898] Re: WSGI and wsgihandler.py

2009-12-27 Thread annet
Massimo,

Thanks for the link.

I have another question, in the forum post mentioned above I also
read:


 from another terminal, kill web2py process according to web2py's
 output instructions

 Start your app:
~/webapps/apachewsgi/apach2/bin/start


To which Mengu added:

 when you start web2py with the command python web2py.py, it outputs
 something like this:
 please visit:
http://127.0.0.1:8000
 use kill -SIGTERM 9813 to shutdown the web2py server

 so basically, you need to fire up another terminal window to ssh into
 your webfaction account and use kill -SIGTERM 9813. that's what it
 means.


I thought web2py is a long running process but from these
instructions I learn that I kill web2py and start apache? Is that
right.

On my Mac Server I used Screen Sharing to start web2py, and run web2py
as a long running process, that is, I didn't 'kill' it. How does that
work at WebFaction
is web2py started everytime there is a request an then stopped?

Kind regards,

Annet.

--

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




[web2py:37922] admin disabled because unable to access password file

2009-12-28 Thread annet
When I access my web2py application at: 
https://admin.domain.com/welcome/default/index
and navigate to the administrative interface, I get the following
error:

admin disabled because unable to access password file


This is how I started web2py:


[...@webxxx ~]$ cd webapps/apachewsgi/web2py
[...@webxxx web2py]$ python2.5 web2py.py
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.74.4 (2009-12-23 10:12:11)
Database drivers available: SQLite3, MySQL, PostgreSQL
Starting cron...
choose a password:
please visit:
http://127.0.0.1:8000
use kill -SIGTERM x to shutdown the web2py server


I then opened a second terminal appliaction and did:


[...@webxxx ~]$ cd webapps/apachewsgi/web2py
[...@webxxx web2py]$ kill -SIGTERM x


According to the instructions in this post:

http://forum.webfaction.com/viewtopic.php?pid=8844#p8844

The password is stored in the file: 'parameters_.py'


That file, indeed, resides in the web2py folder: parameters_8000.py.
Why is web2py unable to access it then. Permissions are set to: -rw-rw-
r--.


Kind regards,

Annet.

--

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




[web2py:37924] Re: WSGI and wsgihandler.py

2009-12-28 Thread annet
Massimo,

Thanks for your explanation.

Kind regards,

Annet.

--

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




[web2py:37925] Re: admin disabled because unable to access password file

2009-12-28 Thread annet
Thadeus,

Thanks for your reply, it pointed me in the right direction. I had to
change the file name to parameters_80.py to solve the problem.

I find all the port stuff rather confusing. In the httpd.conf file:

Listen is set to: 32043

NameVirtualHost and VirtualHost are set to: 127.0.0.1:8000


.. and, when web2py start it creates a file called 'parameters_8000.py
which I have to rename 'parameters_80.py' to be able to use the web-
based administrative interface.

Why?


Kind regards,

Annet.

--

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




[web2py:38428] auth_user already exists

2010-01-06 Thread annet
I have one application (called base) in which I define all the tables
for three other applications. In the three applications I use the same
db.py file. In these db.py files I set migrate=False on all tables.

One of these applications is a CMS, in which I enabled Authorization
and Authentication. This creates the .table files for auth_event, auth-
group, auth_membership, auth_permission and auth_user in the databases
folder of the cms application, all the .table files for the other
tables are in the databases folder of the base application.

When I expose a function of the cms application I get the following
error ticket:


Error traceback

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py,
line 173, in restricted
exec ccode in environment
  File /Library/Python/2.5/site-packages/web2py/applications/cms/
models/db.py, line 650, in module
Field('registration_key', length=128, writable=False,
readable=False, default=''))
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
1249, in define_table
t._create(migrate=migrate, fake_migrate=fake_migrate)
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
1666, in _create
self._db._execute(query)
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
952, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
ProgrammingError: relation auth_user already exists


Is this because the .table files related to authorization and
authentication are in a different application than the other .table
files? Is there a way to solve this problem?


Kind regards,

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




[web2py:38431] Re: auth_user already exists

2010-01-06 Thread annet
I have given my question some more thought. Is it possible to generate
the tables related to authorization and authentication in the base
app, which also contains the other table definitions of my apps. And
then in the cms app just uncomment the following lines of code:


from gluon.tools import *
auth=Auth(globals(),db)  # authentication/
authorization

crud=Crud(globals(),db)  # for CRUD helpers using
auth

mail=Mail()  # mailer
mail.settings.server='smtp.gmail.com:587'# your SMTP server
mail.settings.sender='y...@gmail.com' # your email
mail.settings.login='username:password'  # your credentials or
None
auth.settings.mailer=mail# for user email
verification


... and add the table definitions for the auth_event, auth-group,
auth_membership, auth_permission and auth_user tables and set
migrate=False on these tables. In that case I wil have all my .table
files in one application and only one sql.log file.


Kind regards,

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




[web2py:38451] Re: auth_user already exists

2010-01-06 Thread annet
I tried something else, in the auth_table definition I set
migrate=False and I made the auth.define_tables() statement a comment:

# auth.define_tables() # creates all needed
tables

I am now able to expose the default/index function and the functions
that do not require login, however, in the list of available databases
and tables only the auth_user table is listed. The auth_event, auth-
group, auth_membership, auth_permission tables are not listed.
Their .table files are in the databases folder and the PostgreSQL
database contains the respective tables. Why aren't they listed, they
have been defined. So no solution to the problem.


Kind regards,

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




[web2py:38459] Re: auth_user already exists

2010-01-06 Thread annet
Massimo,

Thanks for your reply.

 Back to your original problem:

 2) You have a custom auth_user in the wrong place in db.py (or with
 wrong syntax) and the table gets defined twice. I am pretty sure this
 is the case but I cannot point to the error if I do not see the code.


This is the code I have in db.py:

from gluon.tools import *
auth=Auth(globals(),db)  # authentication/
authorization
# auth.settings.hmac_key='sha512:a94ab0df-7d00-4326-bc4b-e8732ed0e81a'

auth_table=db.define_table(auth.settings.table_user_name,
Field('bedrijf', db.bedrijf, default='',
notnull=True,ondelete='CASCADE', writable=False, readable=False),
Field('first_name', length=128, default='', notnull=True),
Field('last_name', length=128, default='', notnull=True),
Field('email', length=128, default='', notnull=True),
Field('site', type='boolean', writable=False, readable=False),
Field('username', length=128, default='', notnull=True,
unique=True),
Field('password', type='password', length=256, readable=False,
default='', notnull=True),
Field('created_on',type='datetime', writable=False,
readable=False),
Field('modified_on',type='datetime', writable=False,
readable=False),
Field('most_recent_login',type='datetime', writable=False,
readable=False),
Field('registration_key', length=128, writable=False,
readable=False, default=''))

auth_table.bedrijf.requires=[IS_IN_DB(db, db.bedrijf.id, '%
(bedrijfsnaam)s')]
auth_table.bedrijf.label='Bedrijf * '
auth_table.first_name.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_NOT_EMPTY()]
auth_table.first_name.label='Voornaam * '
auth_table.last_name.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_NOT_EMPTY()]
auth_table.last_name.label='Achternaam * '
auth_table.email.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_EMAIL(), IS_NOT_EMPTY()]
auth_table.email.label='E-mail * '
auth_table.site.default=False
auth_table.username.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_NOT_EMPTY(), IS_NOT_IN_DB(db,
'auth_user.username')]
auth_table.username.label='Gebruikersnaam * '
auth_table.password.requires=[IS_NOT_EMPTY(), CRYPT()]
auth_table.password.label='Wachtwoord * '
auth_table.created_on.default=request.now
auth_table.modified_on.default=request.now
auth_table.modified_on.update=request.now
auth_table.most_recent_login.default=request.now
auth.settings.table_user=auth_table

auth.define_tables() # creates all needed
tables


I hope this provides you with sufficient information to help me solve
the problem.


The fact that the tables related to authentication and authorization
are defined in a different application than the other tables isn't a
problem then?


Kind regards,

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




[web2py:38463] Re: auth_user already exists

2010-01-06 Thread annet
Massimo,

I had a look at the sql.log file. The tables were created on
2009-12-29. When I exposed the default/index function this morning, at
timestamp: 2010-01-06T09:39:53.092633, I got the ticket mentioned
above. I retried exposing the function: timestamp:
2010-01-06T09:40:47.816061. And when I set migrate=False on the
auth_user table I got the same sort of ticket related to the
auth_group table: timestamp: 2010-01-06T10:15:49.520088.



timestamp: 2009-12-29T12:47:45.409885
CREATE TABLE auth_user(
id SERIAL PRIMARY KEY,
bedrijf INTEGER REFERENCES bedrijf(id) ON DELETE CASCADE,
first_name VARCHAR(128) NOT NULL,
last_name VARCHAR(128) NOT NULL,
email VARCHAR(128) NOT NULL,
site CHAR(1),
username VARCHAR(128) NOT NULL UNIQUE,
password VARCHAR(256) NOT NULL,
created_on TIMESTAMP,
modified_on TIMESTAMP,
most_recent_login TIMESTAMP,
registration_key VARCHAR(128)
);
success!
timestamp: 2009-12-29T12:47:45.570175
CREATE TABLE auth_group(
id SERIAL PRIMARY KEY,
role VARCHAR(512),
description TEXT
);
success!
timestamp: 2009-12-29T12:47:46.130429
CREATE TABLE auth_membership(
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES auth_user(id) ON DELETE CASCADE,
group_id INTEGER REFERENCES auth_group(id) ON DELETE CASCADE
);
success!
timestamp: 2009-12-29T12:47:46.145741
CREATE TABLE auth_permission(
id SERIAL PRIMARY KEY,
group_id INTEGER REFERENCES auth_group(id) ON DELETE CASCADE,
name VARCHAR(512),
table_name VARCHAR(512),
record_id INTEGER
);
success!
timestamp: 2009-12-29T12:47:46.162354
CREATE TABLE auth_event(
id SERIAL PRIMARY KEY,
time_stamp TIMESTAMP,
client_ip VARCHAR(512),
user_id INTEGER REFERENCES auth_user(id) ON DELETE CASCADE,
origin VARCHAR(512),
description TEXT
);
success!
timestamp: 2010-01-06T09:39:53.092633
CREATE TABLE auth_user(
id SERIAL PRIMARY KEY,
bedrijf INTEGER REFERENCES bedrijf(id) ON DELETE CASCADE,
first_name VARCHAR(128) NOT NULL,
last_name VARCHAR(128) NOT NULL,
email VARCHAR(128) NOT NULL,
site CHAR(1),
username VARCHAR(128) NOT NULL UNIQUE,
password VARCHAR(256) NOT NULL,
created_on TIMESTAMP,
modified_on TIMESTAMP,
most_recent_login TIMESTAMP,
registration_key VARCHAR(128)
);
timestamp: 2010-01-06T09:40:47.816061
CREATE TABLE auth_user(
id SERIAL PRIMARY KEY,
bedrijf INTEGER REFERENCES bedrijf(id) ON DELETE CASCADE,
first_name VARCHAR(128) NOT NULL,
last_name VARCHAR(128) NOT NULL,
email VARCHAR(128) NOT NULL,
site CHAR(1),
username VARCHAR(128) NOT NULL UNIQUE,
password VARCHAR(256) NOT NULL,
created_on TIMESTAMP,
modified_on TIMESTAMP,
most_recent_login TIMESTAMP,
registration_key VARCHAR(128)
);
timestamp: 2010-01-06T10:15:49.520088
CREATE TABLE auth_group(
id SERIAL PRIMARY KEY,
role VARCHAR(512),
description TEXT
);


Kind regards,

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




[web2py:38465] Re: auth_user already exists

2010-01-06 Thread annet
Massimo,

The line now reads like:

auth.settings.table_user=db.define_table
(auth.settings.table_user_name,


What should the validators read like:

auth_table.bedrijf.requires=[IS_IN_DB(db, db.bedrijf.id, '%
(bedrijfsnaam)s')]

This results in an error.


I got the line of code I used to define the table from the manual:
page 245 of the .pdf file. (Customizing Auth)


Kind regards,

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




[web2py] html e-mail newsletter

2010-03-06 Thread annet
From this article I learned how to code an html e-mail newsletter:

http://articles.sitepoint.com/article/code-html-email-newsletters

Now I would like to send this newsletter from within a Web2py CRM
application. I searched the group for how to instructions but I didn't
find anything useful. I tried the link in this post:

http://groups.google.com/group/web2py/browse_thread/thread/83ee213ce5d3db0c/2ba13207adf09e57?lnk=gstq=html+email#2ba13207adf09e57

but that resulted in an unable to connect warning. I tried the link to
the wiki from Web2py's homepage but that resulted in an internal
error.

I hope one of you could provide me with detailed instructions of how
to send an html e-mail newsletter from a Web2py application.


Kind regards,

Annet.

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



[web2py] Using the Template System to Generate Emails

2010-03-12 Thread annet
I am trying to work out a working version of this: Using the Template
System to Generate Emails,  page 146 -147 of the web2py.

1. The database table in db.py:
db.define_table('nfa',
 
Field('bedrijf',db.bedrijf,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
 
Field('nfatype',db.nfatype,default='',notnull=True,ondelete='RESTRICT'),
Field('adres',length=72,default='',notnull=True),
migrate=False)

2. The mail settings in db.py:
from gluon.tools import *
mail=Mail()
mail.settings.server='smtp.web...ion.com:587'
mail.settings.sender='adm...ise.eu'
mail.settings.login='xx'

Where I would like to send every comapny in a message , stored in a
view file html_mail.html:

3. The function in default.py
def send_mail():
 
nfas=db(db.nfa.nfatype==3).select(db.nfa.ALL,orderby=db.nfa.bedrijf)
for nfa in nfas:
context = dict(nfa=nfa)
message = response.render('html_mail.html', context)
mail.send(to=['.'], subject='None', message=message)
.


My questions are: what goes here: to= [''] the mail address to
which I would like to send the mail is in nfas.adres and how does this
function end, I mean what goes at the ...


Kind regards,

Annet.

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



[web2py] Re: Using the Template System to Generate Emails

2010-03-14 Thread annet
Hi Denes,

This send_mail function works:

def send_mail():
 
nfas=db(db.nfa.nfatype==4).select(db.nfa.ALL,orderby=db.nfa.bedrijf)
for nfa in nfas:
context=dict(nfa=nfa)
message=response.render('clublocatormail/
send_mail.html',context)
recipient=nfa.adres
mail.send(to=[recipient],subject='Controleer uw adresgegevens
in Fitwise',message=message)
return True

I do have a question though: why recipient=nfa.adres and not
recipient=nfa[0].adres

Furthermore, I don't think this function is very robust. It returns
True on success, but that's all. What happens when the send function
returns a False? Shouldn't I keep track of the Trues and Falses the
send function returns for every mail sent?


Kind regards,

Annet

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



[web2py] Re: Using the Template System to Generate Emails

2010-03-18 Thread annet
Hi Denes,

 because you have for nfa in nfas: so each nfa is a record
 (from the group of records or 'Rows' object called nfas)

This is what caused my confusion, in my cms app I had the following
lines of code:

record=db(db.betalingsgegevens.bedrijf==auth.user.bedrijf).select()
record_id=record[0].id

I thought that was similar to:

for nfa in nfas:
recipient=nfa.adres

I do see the difference now, thanks.


Kind regards,

Annet

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



[web2py] Re: Using the Template System to Generate Emails

2010-03-19 Thread annet
In my application all functions related to sending mail from it work.
The main function reads like:

def send_mail():
 
nfas=db(db.nfa.nfatype==4).select(db.nfa.ALL,orderby=db.nfa.bedrijf)
for nfa in nfas:
context=dict(nfa=nfa)
message=response.render('clublocatormail/
send_mail.html',context)
recipient=nfa.adres
mail.send(to=[recipient],subject='Controleer uw adresgegevens
in Fitwise',message=message)
return True

The send_mail.html view reads like (I removed the irrelevant parts):


html
head
   meta http-equiv=Content-Type content=text/html; charset=utf-8
   titleTemplate - Single Column/title
/head
style type=text/css media=screen
  body {
 background-color: #ee;
  }
/style
body
table width=100% border=0 cellspacing=0 cellpadding=0
class=bg1
   tr
  td align=center
 table width=600 border=0 cellspacing=0 cellpadding=0
class=bg2
tr
   td class=permission align=left
  {{if not request.function=='browser_version':}}
  h1Having trouble viewing this email?
{{=A('View it in your browser',
_href={{=URL(r=request,a='mock_crm',c='clublocatormail',f='browser_version',args=[nfa.bedrijf]))}}./
h1
  {{pass}}
   /td
/tr
tr
   td class=header align=left
  img src={{=URL(r=request,c='static',f='template/
header.gif')}} alt=Header width=600 height=150 /
   /td
/tr
tr
   td valign=top class=body
  table width=100% border=0 cellspacing=0
cellpadding=0
 tr
td valign=top class=mainbar align=left
   h2/h2
   img class=hr
src={{=URL(r=request,c='static',f='template/hr.gif')}} alt=Header
width=560 height=3 /
   p{{=nfa.bedrijf}}/p
   p{{=nfa.adres}}/
p
   br /
/td
 /tr
  /table
   /td
/tr
tr
   td valign=middle align=left class=footer
height=61
  p/p
   /td
/tr
 /table
  /td
   /tr
/table
/body
/html


I based this code on this article: 
http://articles.sitepoint.com/article/code-html-email-newsletters
and the templates referred to. I had hoped the view would display
without trouble, but it doesn't. In all mail clients and web based
apps, it displays as plain text, so the html is not rendered. I have
been trying to find out why for two days now, and hope one of you can
come to my rescue.

Kind regards,

Annet.

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



[web2py] Re: Using the Template System to Generate Emails

2010-03-20 Thread annet
Denes and Alexandre,

Your replies were very helpful and helped me understand and solve the
problem, thanks.


Thadeus,

 Use the following class lined out in the wiki, works like a charm.

I will, in one of the next iterations. At the moment I am not yet
proficient enough in Python to completely understand the class
outlined in the wiki, and consequently unable to use it properly.


Kind regards,

Annet.

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



[web2py] Re: Using the Template System to Generate Emails

2010-03-20 Thread annet
I have another question:

In case the user would like to view the html mail in his browser, I
have got the following line of code:

td class=browser align=left
{{if not request.function=='browser_version':}}
   pHaving trouble viewing this email? a
href={{=URL(r=request,c='clublocatormail',f='browser_version',args=[nfa.bedrijf])}}View
it in your browser/a/p
{{pass}}
/td


I would like to use the same view, however, that view contains the
variable nfa.bedrijf, which, in case of the mail, is available from
the context. The link to the browser_version function contains
args=[nfa.bedrijf], so nfa.bedrijf is available as request.args[0] in
the browser_version function, but I don't now to pass it on to the
view in a suitable way.

I could do:

def browser_version():
response.view='send_mail.html'
 
nfa=db((db.nfa.nfatype==4)(db.nfa.bedrijf==request.args[0])).select(db.nfa.ALL)
return dict(nfa=nfa)

..., but that would unnecessarily query the database. Is there another
way to solve this problem?


Kind regards,

Annet.

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



[web2py] Mailing list.

2010-03-20 Thread annet
In my application I have a table npa which contains non-physical
addresses, i.e. telephone numbers, fax numbers, e-mail addresses etc.
that are displayed on business cards. This table has a field company
which references a table company. Initially I inserted addresses into
these tables which I got from the Chamber of Commerce. Now I would
like to send a first e-mail to these companies, based on the e-mail
addresses in the npa table. In this first mail the recipient gets the
opportunity to register himself as contact person for a company. The
table contact_person contains a field e-mail_address, which I would
like to use for future promotional e-mails, instead of the e-mail
address in the npa table. However, if the recipient doesn't register
as a contact person, I have to be able to use the e-mail address from
the npa table.

Furthermore, I need a table which keeps track of the unsubscribe
request.

Did one of you face a similar problem? How did you solve it?

Kind regards,

Annet.

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



[web2py] Re: Using the Template System to Generate Emails

2010-03-21 Thread annet
In the send_mail.html view I have a link which reads like:

pHaving trouble viewing this email? a
href={{=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijf])}}
target=_blankView it in your browser/a/p

When I send the mail and open it this link reads like:

pHaving trouble viewing this email? aView it in your browser/a/
p

Does one of you know why the href isn't being rendered?

Kind regards,

Annet.

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



[web2py] Drop boxes in 1.76.5

2010-03-21 Thread annet
Today, I upgraded my web2py installation to version 1.76.5. In this
web2py version the drop boxes display an empty key value pair first,
and then the key value pairs from the tables I based them on. What
causes this change in behaviour? How do I correct it?

Kind regards,

Annet.

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



[web2py] href not being rendered

2010-03-23 Thread annet
In a send_mail.html view I have a link which reads like:

pHaving trouble viewing this email? a
href={{=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijf])}}
target=_blankView it in your browser/a/p

When I send the mail and open it this link reads like:

pHaving trouble viewing this email? aView it in your browser/a/
p

Does one of you know why the href isn't being rendered?

Kind regards,

Annet.

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



[web2py] Cleanup sessions

2010-03-27 Thread annet
I have just moved my application from the development environment to a
production environment. I read the web2py manual and some posts in the
group on the subject of cleaning up sessions, but I am not sure which
is the best way to proceed. I am running version 1.76.5 of web2py.

Kind regards,

Annet

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



[web2py] Web2py mounted to sub-url

2010-04-01 Thread annet
When I use the custom install script at WebFaction to install web2py
the docs point me to the following caveat:

Web2py won't work properly if it is mounted to a sub-URL like
http://domain.com/web2py/. it must be mounted to the domain root.

What exactly does this mean?


Kind regards,

Annet.

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



[web2py] args problem in 1.76.5

2010-04-04 Thread annet
After upgrading to web2py version 1.76.5 one of the functions I
defined no longer works.

I defined a table newsmonth:

db.define_table('newsmonth',
 
db.Field('number',type='integer',length=2,default='',notnull=True),
db.Field('month',length=14,default='',notnull=True,unique=True),
db.Field('publish',type='boolean'),
migrate=False)

... which I use to display archived news items per month. Number is
the number of the month e.g April 4. Month is a string, for April it
reads like: April 2010. Publish defaults to false and is set to true
on the 1st of the next month.

In the view I have a list with links:

March 2010
february 2010
january 2010

When the visitor clicks March 2010, the news table is queried:

def archive():
 
months=db(db.newsmonth.publish==True).select(db.newsmonth.ALL,orderby=~db.newsmonth.id)
news=[]
month=[]
if request.args:
news=db(db.news.publishing_date.month()==request.args[0])\
.select(db.news.ALL,orderby=~db.news.publishing_date)
month=request.args[1]
if not news:
response.flash='Select an archived month'
else:
response.flash='Select an archived month'
return dict(months=months,news=news,month=month)

month is set to request.args[1], i.e March 2010, and returned to the
view:


div id=twoColLayout
  div id=primarycontent

  div id=month
h3Nieuws {{=month.replace('_',' ')}}/h3
table
  thead
tr
  td/td
/tr
  /thead
  tbody
{{for item in news:}}
  tr
td
 
h5{{=db.news.publishing_date.formatter(item.publishing_date)}}/h5
/td
td
 
{{=A(item.title,_onmouseover=this.style.cursor='pointer';,\
 
_onclick=javascript:newsdetails('%s')%URL(r=request,f='details',args=[item.id]))}}
/td
  /tr
{{pass}}
  /tbody
/table
  /div !-- month --
  /div !-- primarycontent --
  div id=sidecontent
div class=sidebox
  h3Archived months:/h3
  table
tbody
  {{for month in months:}}
tr
  td
 
{{=A(month.month,_href=URL(r=request,args=[month.number,month.month]))}}
  /td
/tr
  {{pass}}
/tbody
  /table
/div !-- sidebox --
  /div !-- sidecontent --
/div !-- twoColLayout --



When I expose the archive function, the view displays well. The URL
reads like: http://127.0.0.1:8000/init/news/archive

However, when I click one of the archived months links I get an
invalid request error.

The link in the view reads like: a href=init/news/archive/3/March
%202010March 2010/a

... the URL in the browser reads like: 
http://127.0.0.1:8000/init/news/archive/3/maart%202010


Since the function works without args, I suppose the error has
something to do with the args, the porblem is I can't figure out what.


Kind regards,

Annet.

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



[web2py] args problem in 1.76.5

2010-04-04 Thread annet
After upgrading to web2py version 1.76.5 one of the functions I
defined no longer works.

I defined a table newsmonth:

db.define_table('newsmonth',

db.Field('number',type='integer',length=2,default='',notnull=True),
db.Field('month',length=14,default='',notnull=True,unique=True),
db.Field('publish',type='boolean'),
migrate=False)

... which I use to display archived news items per month. Number is
the number of the month e.g April 4. Month is a string, for April it
reads like: April 2010. Publish defaults to false and is set to true
on the 1st of the next month.

In the view I have a list with links:

March 2010
february 2010
january 2010

When the visitor clicks March 2010, the news table is queried:

def archive():

months=db(db.newsmonth.publish==True).select(db.newsmonth.ALL,orderby=~db.newsmonth.id)
news=[]
month=[]
if request.args:
news=db(db.news.publishing_date.month()==request.args[0])\
.select(db.news.ALL,orderby=~db.news.publishing_date)
month=request.args[1]
if not news:
response.flash='Select an archived month'
else:
response.flash='Select an archived month'
return dict(months=months,news=news,month=month)

month is set to request.args[1], i.e March 2010, and returned to the
view:

div id=twoColLayout
  div id=primarycontent

  div id=month
h3Nieuws {{=month.replace('_',' ')}}/h3
table
  thead
tr
  td/td
/tr
  /thead
  tbody
{{for item in news:}}
  tr
td

h5{{=db.news.publishing_date.formatter(item.publishing_date)}}/h5
/td
td

{{=A(item.title,_onmouseover=this.style.cursor='pointer';,\

_onclick=javascript:newsdetails('%s')%URL(r=request,f='details',args=[item.id]))}}
/td
  /tr
{{pass}}
  /tbody
/table
  /div !-- month --
  /div !-- primarycontent --
  div id=sidecontent
div class=sidebox
  h3Archived months:/h3
  table
tbody
  {{for month in months:}}
tr
  td

{{=A(month.month,_href=URL(r=request,args=[month.number,month.month]))}}
  /td
/tr
  {{pass}}
/tbody
  /table
/div !-- sidebox --
  /div !-- sidecontent --
/div !-- twoColLayout --

When I expose the archive function, the view displays well. The URL
reads like: http://127.0.0.1:8000/init/news/archive

However, when I click one of the archived months links I get an
invalid request error.

The link in the view reads like: a href=init/news/archive/3/March
%202010March 2010/a

... the URL in the browser reads like: 
http://127.0.0.1:8000/init/news/archive/3/March%202010

Since the function works without args, I suppose the error has
something to do with the args, the porblem is I can't figure out what.

Kind regards,

Annet.

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



[web2py] Re: args problem in 1.76.5

2010-04-04 Thread annet
In the view, when I replace:

td
 
{{=A(month.month,_href=URL(r=request,args=[month.number,month.month]))}}
/td


with:


td
  {{=A(month.maand,_href=URL(r=request,args=[3,'maart_2010']))}}
/td



The function works.
When I replace the underscore with a space:


td
  {{=A(month.maand,_href=URL(r=request,args=[3,'maart 2010']))}}
/td


The space is being replaced with %20 and the function no longer works.
Hopes this helps you help me solve the problem.


Annet.

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



[web2py] Re: args problem in 1.76.5

2010-04-04 Thread annet
In the view, when I replace:

td

{{=A(month.month,_href=URL(r=request,args=[month.number,month.month]))}}
/td

with:

td
  {{=A(month.month,_href=URL(r=request,args=[3,'maart_2010']))}}
/td

The function works.
When I replace the underscore with a space:

td
  {{=A(month.month,_href=URL(r=request,args=[3,'maart 2010']))}}
/td

The space is being replaced with %20 and the function no longer works.
Hopes this helps you help me solve the problem.

Annet.

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



[web2py] Re: args problem in 1.76.5

2010-04-05 Thread annet
Massimo,

The problem is that web2py did replace spaces with underscores, but in
version 1.76.x it no longer does. The function described above worked,
until I upgraded to version 1.76.5.

That's why I have this line of code in my view:

h3Nieuws {{=month.replace('_',' ')}}/h3

to have the month display like without the underscore: April 2009
instead of April_2009


Kind regards,

Annet.

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



[web2py] ProgrammingError: relation auth_user already exists

2010-04-12 Thread annet
I have one application (called base) in which I define all the tables
for three other applications. In the three applications I use the same
db.py file. In these db.py files I set migrate=False on all tables.

One of these applications is a CMS, in which I enabled Authorization
and Authentication. This creates the .table files for auth_event,
auth- group, auth_membership, auth_permission and auth_user in the
databases folder of the cms application, all the .table files for the
other
tables are in the databases folder of the base application.

Today I defined four more tables in the base application's db.py file,
and copied and paste them to the db.py files of the other
applications, and set migrate=False on these tables. After saving the
db.py file of the CMS application I got the following error when I go
to the database administration:

ProgrammingError: relation auth_user already exists

Does this mean I cannot make changes to the db.py file in which
Authorization and Authentication are enabled? i.e. I can only save the
db.py file once.


Kind regards,

Annet.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] Re: ProgrammingError: relation auth_user already exists

2010-04-12 Thread annet
Could it have anything to do with defining a custom auth_user tabel?

auth.settings.table_user=db.define_table('auth_user',
Field('bedrijf', db.bedrijf, default='',
notnull=True,ondelete='CASCADE', writable=False, readable=False),
Field('first_name', length=128, default='', notnull=True),
Field('last_name', length=128, default='', notnull=True),
Field('email', length=128, default='', notnull=True),
Field('site', type='boolean', writable=False, readable=False),
Field('username', length=128, default='', notnull=True,
unique=True),
Field('password', type='password', length=256, readable=False,
default='', notnull=True),
Field('created_on',type='datetime', writable=False,
readable=False),
Field('modified_on',type='datetime', writable=False,
readable=False),
Field('most_recent_login',type='datetime', writable=False,
readable=False),
Field('registration_key', length=128, writable=False,
readable=False, default=''))

db.auth_user.bedrijf.requires=[IS_IN_DB(db, db.bedrijf.id, '%
(bedrijfsnaam)s')]
db.auth_user.bedrijf.label='Bedrijf * '
db.auth_user.first_name.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_NOT_EMPTY()]
db.auth_user.first_name.label='Voornaam * '
db.auth_user.last_name.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_NOT_EMPTY()]
db.auth_user.last_name.label='Achternaam * '
db.auth_user.email.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_EMAIL(), IS_NOT_EMPTY()]
db.auth_user.email.label='E-mail * '
db.auth_user.site.default=False
db.auth_user.username.requires=[IS_LENGTH(128,error_message='lengte
overschreidt 128 tekens'), IS_NOT_EMPTY(), IS_NOT_IN_DB(db,
'auth_user.username')]
db.auth_user.username.label='Gebruikersnaam * '
db.auth_user.password.requires=[IS_NOT_EMPTY(), CRYPT()]
db.auth_user.password.label='Wachtwoord * '
db.auth_user.created_on.default=request.now
db.auth_user.modified_on.default=request.now
db.auth_user.modified_on.update=request.now
db.auth_user.most_recent_login.default=request.now


Kind regards,

Annet.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] Unable to install application

2010-04-12 Thread annet
I installed web2py 1.76.5 at webfaction using their latest custom
installer script. I am able to login to the admin application,
however, when I Upload and Install a packed application I get the
error: unable to install application init.

I hope one of you can help me solve this problem.


Kind regards,

Annet.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] Re: ProgrammingError: relation auth_user already exists

2010-04-12 Thread annet
Massimo,

Yes, that would solve the problem, but I do have data in the auth_xxx
tables. I had hoped there would be a more robust solution. Isn't it
possible to define the auth_event, auth- group, auth_membership,
auth_permission and auth_user in db.py just like I define all the
other tables, and after the tables have been created set their
migrates to migrate=False. I mean to not use auth.define_tables() to
create the tables. In that case the auth_xxx tables are created once,
and longer touched when I edit the db.py file.

Kind regards,

Annet.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] Re: Unable to install application

2010-04-13 Thread annet
Chris,

Thank you very much for your extensive reply to my post. I apologize
for not replying earlier (bedtime ;-) )

The script you reference above is indeed the one I used to install
web2py: http://wiki.webfaction.com/wiki/Web2py-LatestSource

I first tried to install web2py manually based on these instructions:
http://forum.webfaction.com/viewtopic.php?id=2373 I did get web2py
installed this way in December, however, in March I didn't. At
WebFaction they advised me to use their installer script to install
web2py, and emphasized that I should not start/stop web2py myself.

I'll get in touch with them, and reference the links you posted. I'll
let you know when the problem is solved.

Kind regards,

Annet.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] Re: Unable to install application

2010-04-13 Thread annet
Chris,

Thank you very much for your extensive reply to my post. I apologize
for not replying earlier (bedtime ;-) )

The script you reference above is not the one I used to install
web2py. I read my log and found out that WebFaction no longer provides
the scrip I used:

web2py:http://wiki.webfaction.com/wiki/Web2py-TrunkInstall?format=txt


I first tried to install web2py manually based on these instructions:
http://forum.webfaction.com/viewtopic.php?id=2373 I did get web2py
installed this way in December, however, in March I didn't. At
WebFaction they advised me to use their installer script to install
web2py, and emphasized that I should not start/stop web2py myself.

I'll get in touch with them, and reference our findings. I'll let you
know when the problem is solved.

Kind regards,

Annet.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] _href and src url not rendered

2010-04-17 Thread annet
In the view of a html mail function I have got the following A-helper
and img tag:

td class=browserversion align=left
pHaving trouble viewing this email? {{=A('View it in your browser',
_href=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target=_blank)}}/p
/td


td class=header align=left
img src={{=URL(r=request,c='static',f='template/header.jpg')}}
alt=Header width=600 height=192 /
/td


When I expose the function both locally and on the server the _href
and src attributes aren't rendered, i.e. when I open the mail in a
mail client or for example roundcube web mail the attributes just
aren't there:


td class=browserversion align=left
pHaving trouble viewing this email? aView it in your browser/a/
p
/td

td class=header align=left
img alt=Header width=600 height=192 
/td


Does one of you know why, and how to solve this problem?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: _href and src url not rendered

2010-04-17 Thread annet
)
\
(db.contactpersoon.subscription==True))\

.select(db.bedrijf.bedrijfsnaam,db.bedrijfcontactpersoon.bedrijf,db.contactpersoon.id,db.contactpersoon.email,
\
orderby=db.bedrijfcontactpersoon.bedrijf)
return dict(item=item)


And in the view replace item with item[0]. Then, when I expose the
not_send_mail function the view is rendered correctly:


td class=browserversion align=left
pHaving trouble viewing this email?
a href=/mock_crm/clublocatormail/browser_version/2/2
_target=_blank
/p
/td

td class=header align=left
img src=/mock_crm/static/template/header.jpg alt=Header
width=600 height=192
/td


Kind regards,

Annet


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: _href and src url not rendered

2010-04-17 Thread annet
==True))\

.select(db.bedrijf.bedrijfsnaam,db.bedrijfcontactpersoon.bedrijf,db.contactpersoon.id,db.contactpersoon.email,
\
orderby=db.bedrijfcontactpersoon.bedrijf)
return dict(item=item)


... and in its view, which is identical to the one above, I replaced
the item attributes with item[0]. When I expose the latter the _href
and scr attributes are rendered correctly:


td class=browserversion align=left
pHaving trouble viewing this email?
a href=/mock_crm/clublocatormail/browser_version/2/2
_target=_blankView it in your brwoser/a
/p
/td

td class=header align=left
img src=/mock_crm/static/template/header.jpg alt=Header
width=600 height=192 
/td


Is it the response.render() function that is causing the problem, or
something else?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] ValueError: invalid literal for int() with base 10:

2010-04-20 Thread annet
In db.py I defined the following tables:


db.define_table('company',
Field('company',length=54,default='',notnull=True),
migrate=False)

db.define_table('application',
 
Field('application',length=24,default='',notnull=True,unique=True),
migrate=False)

db.define_table('companyapplication',
 
Field('company',db.company,default='',notnull=True,ondelete='CASCADE'),
 
Field('application',db.application,default='',notnull=True,ondelete='RESTRICT'),
migrate=False)

db.companyapplication.company.requires=[IS_IN_DB(db,db.company.id,'%
(company)s'),IS_NOT_IN_DB(db(db.companyapplication.application==request.vars.application),db.companyapplication.company,error_message='combination
of company en application already in database')]
db.companyapplication.application.requires=IS_IN_DB(db,db.application.id,'%
(application)s')


In appadmin/insert/db/application I get the following error when I
want to insert an application:

Traceback (most recent call last):
  File /Library/Python/2.5/site-packages/web2py/gluon/restricted.py,
line 173, in restricted
exec ccode in environment
  File /Library/Python/2.5/site-packages/web2py/applications/base/
models/db.py, line 216, in module
 
db.companyapplication.company.requires=[IS_IN_DB(db,db.company.id,'%
(company)s'),IS_NOT_IN_DB(db(db.companyapplication.application==request.vars.application),db.companyapplication.company,error_message='combination
of company and application already in database')]
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
2424, in __eq__
return Query(self, '=', value)
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
2839, in __init__
right = sql_represent(right, left.type, left._db._dbname,
left._db._db_codec)
  File /Library/Python/2.5/site-packages/web2py/gluon/sql.py, line
510, in sql_represent
return str(int(obj))
ValueError: invalid literal for int() with base 10: 'Supplier'


I don't understand why I get an error on the validator of the
companyapplication table whereas I want to insert a record into the
application table.

What's causing this error? How do I solve it?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: ValueError: invalid literal for int() with base 10:

2010-04-20 Thread annet
Massimo,

 The error refer to a field Supplier and I do not see it defined.

'Supplier is the value I enter for the Field application in the
application table.

 Some other part of the code is causing the problem and I cannot help tell
 without look at it all.

Yes, the validator defined after the companyapplication table:

db.define_table('companyapplication',
Field('company',db.company,),
Field('application',db.application),
migrate=False)

db.companyapplication.company.requires=[IS_IN_DB(db,db.company.id,'%
(company)s'),\
IS_NOT_IN_DB(db(db.companyapplication.application==request.vars.application),
\
db.companyapplication.company,error_message='combination
of company en application already in database')]


That's all the information related to this problem. I hope it's enough
to solve the problem, because it's a recurrent one.



Kind regards,

Annet.



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Webfaction rocks

2010-04-20 Thread annet
Hi Thadeus,

You're right, WebFaction rocks. However, when you want to upload and
install a packed application you will have to proceed as follows:

1. Log on to WebFaction via terminal/ssh

2. cd to your remote web2py/application directory

3. Make a directory by the name of the packed application

4. Upload and install the packed web2py application via the web
interface and rename it to match the name of the directory you
manually created.

https://admin.domain_name.com/admin/default/site

In the upload and install form browse to the directory where the
packed application resides, rename it (required)
packed_application_name and check the overwrite installed app check
box. Click install.


Thanks to Chris, who helped me solve this problem!


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: ValueError: invalid literal for int() with base 10:

2010-04-20 Thread annet
Companies in the company table can apply for one or more applications,
therefore I defined the combination table companyapplication. The
company table contains records like:

1   Butson Consultancy
2   Dreamwall
3   Preston Counselors

The application table contains records like:

1   Supplier
2   Consultants
3   Counselors

The companyapplication table contains records like:

1   2
2   1
2   2
3   3


I can insert companies without problems, however, when I want to
insert an application, e.g. Supplier I get the error mentioned above.

I hope I provided you with sufficient information.


Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: ValueError: invalid literal for int() with base 10:

2010-04-24 Thread annet
Hi Denes,

Thanks for providing me with an explanation of why this problem occurs
and with a solution.


 Following such a convention (adding '_id' to denote a reference) is
 highly recommended.

From now on I will follow this convention! I don't know if I am the
only one making this mistake, if not it may be worth posting a slice
on it. It's rather time consuming having alter the database tables in
you model and adjusting your application(s) accordingly.


Kind regards,

Annet


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Webfaction rocks

2010-04-25 Thread annet
I took a somewhat different approach. I signed up for a shared 1 plan
and got a dedicated IP address. Under domains I added two subdomains:
www and admin. Under applications I created a web2py application of
type custom install script (http://wiki.webfaction.com/wiki/Web2py-
LatestSource?format=txt). Under websites I created two websites one
with https disabled for mydomain.com and www.mydomain.com and one with
https enabled for admin .mydomain.com in both cases I selected my
dedicated IP address from the IP menu.

Now admin can be accessed from: https://admin.mydomain.com using the
same initial password as the webfaction control panel. In my post of
20 April I described how to install an application.


Furthermore, according to Massimo this is not true:

CAVEATS
* Web2py won't work properly if it is mounted to a sub-URL like
http://domain.com/web2py/. Instead, it must be mounted to the website
root, e.g. http://domain.com/


Massimo's comment on this caveat:

It is not true. It can be mounted in a sub-url but you the web server
or web2py routes must be instructed to remove the web2py/ from the
url.



Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] pool_size=

2010-04-26 Thread annet
I came across this post:

http://groups.google.com/group/web2py/browse_thread/thread/82c1b8cdc14eddee/45040c681742a3b1?lnk=gstq=pool_size%3D#45040c681742a3b1

... and read paragraph 6.1 and 6.2 of the manual. In paragraph 6.1 the
connection strings reads like:

db = DAL('sqlite://storage.db', pool_size=0); the default. From
'Connection Pooling' I understand I'd better set the pool_size to for
instance 10. In the group I also see connections pools of size 20.
What's the best size to set the pool_size.


Kind regards,

Annet.



[web2py] Re: MySQL server has gone away

2010-04-26 Thread annet
Massimo,

Accessing revision 1854 results in an Internal Server Error.


Kind regards,

Annet.



-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] r=request problem.

2010-04-26 Thread annet
In an html e-mail view I have the following links:

{{=A('View it in your browser',
_href=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,item.contactpersoon.id]),
_target=_blank)}}

img src={{=URL(r=request,c='static',f='crm/media/header.jpg')}}
alt=Header width=600 height=192 /


When I send the mail from within: 
https://admin.fitwise.nl/admin/default/design/mock_crm
the links in the e-mail read like:

a target=_blank href=http://mock_crm/clublocatormail/
browser_version/1/3View it in your browser/a

img src=http://mock_crm/static/crm/media/header.jpg;

Whereas they should read:

a target=_blank href=http://www.fitwise.nl/mock_crm/
clublocatormail/browser_version/1/3View it in your browser/a

img src=http://www.fitwise.nl/mock_crm/static/crm/media/
header.jpg


How do I solve this problem?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: r=request problem.

2010-04-26 Thread annet
Massimo,

Isn't the view being rendered by web2py before it's send to the mail
server?

Regards,

Annet



On Apr 26, 4:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 img src=http://www.fitwise.nl/
 mock_crm{{=URL(r=request,c='static',f='crm/media/header.jpg')}}
 alt=Header width=600 height=192 /

 You know the hostname, the email program does not.

 On Apr 26, 9:21 am, annet annet.verm...@gmail.com wrote:

  In an html e-mail view I have the following links:

  {{=A('View it in your browser',
  _href=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,item.contactpersoon.id]),
  _target=_blank)}}

  img src={{=URL(r=request,c='static',f='crm/media/header.jpg')}}
  alt=Header width=600 height=192 /

  When I send the mail from 
  within:https://admin.fitwise.nl/admin/default/design/mock_crm
  the links in the e-mail read like:

  a target=_blank href=http://mock_crm/clublocatormail/
  browser_version/1/3View it in your browser/a

  img src=http://mock_crm/static/crm/media/header.jpg;

  Whereas they should read:

  a target=_blank href=http://www.fitwise.nl/mock_crm/
  clublocatormail/browser_version/1/3View it in your browser/a

  img src=http://www.fitwise.nl/mock_crm/static/crm/media/
  header.jpg

  How do I solve this problem?

  Kind regards,

  Annet.

  --
  Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: r=request problem.

2010-04-26 Thread annet
Now I understand the problem. When I rewrite the _href:

{{=A('View it in your browser',  _href=http://127.0.0.1:8000; +
URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,item.contactpersoon.id]),
_target=_blank)}}

... the problem is solved. I guess I'd best add a variable containing
the http://127.0.0.1:8000; value e.g. mydomain, and then:

{{=A('View it in your browser',  _href=mydomain +
URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf_id,item.contactpersoon.id]),
_target=_blank)}}


Does anyone know a better solution?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Webfaction rocks

2010-04-27 Thread annet
Aurelien,

Don't you have a domain name? I asked my domain registrar to point my
domain name to WebFaction's domain name servers:

ns1.webfaction.com
ns2.webfaction.com
ns3.webfaction.com
ns4.webfaction.com

Comment: Your domain name registrar may not require all four domain
name servers; enter as many as your domain registrar supports.

I then proceeded as described above, and didn't encounter the
certificate problem, because I have a dedicated IP address.


Regards,

Annet.




-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] request with args

2010-04-28 Thread annet
In one of my functions I redirect the user to another function. I
would like to notify the user that he has been redirect by setting a
flash message, the problem is the args in the url. This is the
function:

if
request==URL(r=request,a='crm',c='clublocatormail',f='update_form'):
response.flash='message'

An example of request would be: 
http://www.fitwise.nl/crm/clublocatormail/update_form/1/1

Is there a way to get rid of the args in the request? Right now the if
will never be true.


Kind regards,

Annet.


[web2py] Re: request with args

2010-04-28 Thread annet
Thadeus and Jonathan,

Thanks for you replies. I am afraid I haven's made myself clear.
However, your replies pointed me in the right direction.

I have an update_form, in which I set the values by querying the
database, which results in four rowsets. When one of the rowsets is
empty, the function breaks. I thought I'd solve this problem by adding
an if which checks if all the rowsets evaluate to true:


def update_form():

if not (club and address and nfas and persoon):
 
redirect(URL(r=request,a='init',c='clublocator',f='application_form'))

return(form=form)


Then in the init/clublocator/application_form function I would check
if the request comes from the crm/clublocatormail/update_form
function:

if
request==URL(r=request,a='crm',c='clublocatormail',f='update_form'):
response.flash='message'


After reading your replies I learnt that maybe just: if request.args
solves my problem.


I supports Thadeus comment on response.flash, it's quite a challenge
to get all your response.flash assignments right, and not overwrite
them elsewhere.


Kind regards,

Annet.


[web2py] auth_ tables problem

2010-05-04 Thread annet
I have one application (called base) in which I define all the tables
for three other applications. In the three applications I use the same
db.py file. In these db.py files I set migrate=False on all tables.

One of these applications is a CMS, in which I enabled Authorization
and Authentication. This creates the .table files for auth_event,
auth- group, auth_membership, auth_permission and auth_user in the
databases folder of the cms application, all the .table files for the
other tables are in the databases folder of the base application.

When I extend the model in the base application's db.py file, i.e.
define new tables, and set migrate=False on these tables and copy and
paste them into the db.py file of the CMS application, after saving
the db.py file, I keep getting the following error when I go to the
database administration:

ProgrammingError: relation auth_user already exists

Am I right to conclude that I cannot make changes to the db.py file in
which Authorization and Authentication are enabled? i.e. I can only
save the db.py file once?

Did anyone face the same problem? How did you solve it? Is there a
best practice to dealing with db.py when it comes to defining and
altering tables and using web2py's authentication and authorization
features?


Kind regards,

Annet.


[web2py] Re: auth_ tables problem

2010-05-05 Thread annet
Thanks for your reply,

 have you tried:
             # defines all needed tables without migration/table files
            auth.define_tables(migrate=False)

 where you configure auth for your app?

I didn't now I could set migrate=False on the auth_ tables, this isn't
documented anywhere, is it? I did indeed solve my problem.


Kind regards,

Annet.


[web2py] confirmation dialog on delete

2010-05-05 Thread annet
The jQuery code for confirmation on delete connects the onclick event
of the checkbox with a confirmation dialog. I would like this
confirmation dialog to be triggered by the submit button.

Is it possible to re-write the code in web2py_ajax.html:

jQuery(input[type='checkbox'].delete).click(function() { if
(this.checked) if(!confirm({{=T('Sure you want to delete this
object?')}})) this.checked=false; });

... so that the code connects to the onclick event of the submit and
not the onclick event of the checkbox?


Kind regards,

Annet.


[web2py] Re: auth_ tables problem

2010-05-05 Thread annet
Hi,


 I don´t know if understood your problem right but looks like you are
 using sqlite.

I am using PostgreSQL 8.4.

 If that´s the case I guess it would be better and safer for you to use
 another relational database such as mysql.
 I think the problem could be you don´t have a db server.


Kind regards,

Annet.


[web2py] Re: verify email limitations

2010-05-05 Thread annet
Maybe this post:

http://groups.google.com/group/web2py/browse_thread/thread/420e0001e3c8949c/32a262d1c39cdb02?lnk=gstq=Mar+24#32a262d1c39cdb02


Annet.


[web2py] email form into database table.

2010-05-05 Thread annet
In an application I have forms which on submit are mailed to my mail
box. After verification I manually insert the form data into their
respective tables, e.g. for an application form into the tables:
company, address, nfa, and contact. Since this is a rather time
consuming task I thought of inserting the form data into a form_table
and retrieving them into a four part form (one for every table), and
after verification submitting each form and on form acceptance insert
the data into the individual tables.

I wonder whether there is the right way to proceed or whether there is
a better way to execute this task.


Kind regards,

Annet.


[web2py] Re: email form into database table.

2010-05-06 Thread annet
Massimo,

 You can insert them and have a flag (Field) called appreoved which
 default to false. Than you can send yourself an email with a link to a
 page so that by just clicking on the link you approve it.

I implemented this and gave it a try, just what I was looking for.
Thanks.

Kind regards,

Annet.


[web2py] Re: Data table

2010-05-06 Thread annet
Hi Sverre,

I am using Allan Jardine's DataTables: http://www.datatables.net/


Regards,

Annet.


[web2py] Multiple apps based on one model.

2010-05-07 Thread annet
I read this post in the group: 
http://groups.google.com/group/web2py/browse_thread/thread/6201f9f56bdb16d6,
and I am facing a similar problem.

I have one web2py installation in which I have a base application
which contains all shared files i.e .js and .css files. Within this
application I also defined all database tables, so all .table files
are in the databases folder of this application. Furthermore this
web2py installation contains an init application and b2c, b2b, crm
applications. The db.py files of these applications are copies of the
db.py of the base application with all migrates set to False. From the
post mentioned above I understand I can make a function of the base
app's db.py, name it db_stuff.py and put it in the base application's
modules file:

/web2py/applications/base/modules/db_stuff.py

My first question is: how do I make a function of a db.py file, and
which parts of the db.py file should the function contain?


Then, I should write an import statement in each of the applications
db.py files:

local_import('db_stuff',app='base')

My second question is: what code do these db.py files contain apart
from the import statement?


Kind regards,

Annet.


[web2py] Re: question about webfactional

2010-05-08 Thread annet
Pai,

The solution to your problem is described in this thread:

http://groups.google.com/group/web2py/browse_thread/thread/504dd2deff41f8f4/156e920088c11b85#156e920088c11b85


Basically you have to log on to webfaction via terminal/ssh and
manually create a directory in your remote web2py/applications
directory. You can then upload and install a packed web2py app via the
web interface.


Kind regards,

Annet.


[web2py] Re: Data table

2010-05-08 Thread annet
Hi Sverre,

Here's an example of how you would make the id a link:

table id=init class=display
  thead
tr
  thcompany id/th
  thcompany name/th
/tr
  /thead
  tbody
{{for company in rows:}}
  tr
td
  {{=A(company.id,_onmouseover=this.style.cursor='pointer';,
\
 
_onclick=javascript:clublocatordetails('%s')%URL(r=request,f='details',args=[company.id]))}}
/td
td
  {{=company.name}}
/td
  /tr
{{pass}}
  /tbody
/table

Here the link opens a details view in a new window, but that's
optional.


Regards,

Annet.


[web2py] _onclick to close window

2010-05-08 Thread annet
In custom_ajax.html I defined the following function:

function closeWin() {
  window.close();
  return false;
}


I a function I added a cancel button to a form:

This one works:

form[0][-1]
[1].append(INPUT(_type='button',_value='Cancel',_onclick='javascript:history.go(-1)'))

This one doesn't:

form[0][-1]
[1].append(INPUT(_type='button',_value='Cancel',_onclick='javascript:closeWin()'))

Does one of you know why not?


Kind regards,

Annet.


[web2py] design issue

2010-05-13 Thread annet
I have multiple applications connecting to the same database, some of
them query the database for data on multiple companies others query
the database for data on one company, apart from a company table
containing the company id there is no overlap.

I know web2py can connect to multiple databases, and I wonder whether
it would be possible to have two db.py files: db1.py and db2.py, where
db1.py connects to the database containing the first type of data and
db2.py connects to the company's database. db2.py would also contain
the auth_ tables.

I hope some of you are willing to comment on this idea.


Kind regards,

Annet.


[web2py] Re: design issue

2010-05-14 Thread annet
Hi,

Thank you very much for your extensive reply, it's very helpful, at
least I now have an idea of how to approach this problem.


Kind regards,

Annet



[web2py] expire_sessions.py and cron

2010-05-17 Thread annet
To clean up sessions I ran the following command:

me:~ i$ cd /Library/Python/2.5/site-packages/web2py
me:web2py i$ cp applications/admin/cron/crontab applications/init/cron
me:web2py i$

The crontab file in the init app now reads like:

10  *   *   *   *   root 
**applications/admin/cron/expire_sessions.py


I wonder whether this is correct and whether this a local setting or
works on the server as well.


Kind regards,

Annet.


[web2py] Re: expire_sessions.py and cron

2010-05-18 Thread annet
Massimo,

At webfaction I can do:

[myser...@webxxx ~]$ crontab -l
11,31,51 * * * * /home/fitwise/webapps/customweb2py/apache2/bin/start

/dev/null 21
12,32,52 * * * * /home/fitwise/webapps/customweb2py/apache2/bin/start

/dev/null 21
46 * * * * cd ~/webapps/loganalyzer;./update_awstats.sh
[myser...@webxxx ~]$


... and I can edit this file: crontab -e


I posted a ticket:

Will running the crontab -e command and adding this line: 10
*   *   *   *   root **applications/admin/cron/
expire_sessions.py , solve my problem? What's with the 10, and the
'root ** applications' bit, are they specific to my local system, or
will they work remotely as well.


... to which I got the following reply:

Yes, I bee that the root ** part is specific to your local cron
setup.

I would suggest that you try to figure out which command exactly do
you need to run through the command line, in order to clear the
sessions. If the script is directly executable via the command line,
then you should add the command that you are executing it with to your
crontab. If it is accessible via web, you could add something like
'wget http://yourdomain.com/url/of/script' to your crontab, in order
to trigger a web request to the script.


I hope this helps you help me solve the problem,

Annet.


[web2py] Re: Need help with datatable

2010-05-19 Thread annet
Hi Sverre,

I have a cms application in which I use dataTables. In the view I have
something like:

td
  {{=A('update/delete',_onmouseover=this.style.cursor='pointer';,
_href=URL(r=request,f='update_nfa',args=[record.nfa.id]))}}
/td


... and in the corresponding function:

auth.requires_membership('site_manager')
def update_nfa():
response.view='default/update_form.html'
record=db.nfa[request.args[0]]
if not record or not record.company==auth.user.company:
redirect(URL(r=request,f='crud_nfa'))
form=update_form(db.nfa,record,'crud_nfa',message='Nfa
updated',deletable=True)
return dict(form=form)


... where update_form(...) is a function that performs the actual
update:

def update_form(table,record,next,message,deletable):
 
form=crud.update(table,record,next=(URL(r=request,f=next)),message=message,deletable=deletable)
form[0][-1]
[1].append(INPUT(_type=button,_value=Cancel,_onclick=javascript:history.go(-1)))
return form


I hope you get the idea.

Kind regards,

Annet.


[web2py] Re: CRUD read or OneToOne

2010-05-19 Thread annet

 I want the user to click on the link and if there is already
 a project _location for a project then just display it (crud.read),
 if the project has no location associated, then it will give me
 crud.write. I know it must be simple but I cant figure it out.

I am not sure I do understand your problem correctly, but I'll give it
a try. You list projects, when the user clicks on one of the projects,
depending on the project's location being set or not you either
display the project's details or display an update form

@auth.requires_login()
def update_project_location():
projects=db(..).select(..)
form=[]
if request.args:
project_id=request.args(0)
project=db.project[project_id]
if project[0].location:
form=crud.read(db.project,project_id)
else:
form=crud.update(db.project,project_id)
return(projects=projects,form=form)


I hope this helps to point you in right direction.

Annet.


[web2py] Re: How to send an URL() from a view to a controller?

2010-05-19 Thread annet
 I want to implement a function to back to previous page.

Simply back to the previous page would be something like:

td
 
{{=A('back',_onmouseover=this.style.cursor='pointer';,_onclick=javascript:history.go(-1);)}}
/td


I am not sure but  doesn't this: from documents back to device and
from documents back to workorder contradict this: from device or
workorder view back to documents controller?


Kind regards,

Annet


[web2py] Re: expire_sessions.py and cron

2010-05-19 Thread annet
Massimo,

Thank you very much for providing me with this code, problem solved.


Kind regards,

Annet.


[web2py] Re: Drop Down alternative

2010-05-21 Thread annet
Massimo,

I gave this a try:

from gluon.sqlhtml import AutocompleteWidget

db.define_table('address',
   Field('city',length=42,default='',notnull=True)),
   ...)

db.address.city.widget=AutocompleteWidget(request,db.city.name,db.city.name,orderby=db.city.name)


but that doesn't work, why not?


Kind regards,

Annet.


[web2py] Authentication

2010-05-21 Thread annet
I read chapter 8 of the web2py manual and some post on authentication
to get started (again) implementing a cms.

I read about MD5 and SHA-512, and understand I have to provide a
secret key for this setting: auth.settings.hmac_key='your secret
key' Does this key have a specific format, e.g. 448a98e0-00fd-46b2-
ac4f-a14d2315b189? Or can I use any key? At the moment I am working in
web2py 1.76.5 does this version already use hmac + sha-512?

Furthermore I would like to customize the auth_user table. In the
manual the proper way to define a user table is:

auth_table = db.define_table(auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True),
Field('password', 'password', length=256, readable=False,
label='Password'),
Field('registration_key', length=128, default= '', writable=False,
readable=False))

auth_table.first_name.requires =
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.last_name.requires =
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.password.requires = [IS_STRONG(), CRYPT()]
auth_table.email.requires =
[IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
auth_table.email)]
auth.settings.table_user = auth_table


In a workgroup post of 8 February I read this definition:

auth.settings.table_user = db.define_table('auth_user',
Field('first_name', length=512,default=''),
Field('last_name', length=512,default=''),
Field('email', length=512,default='', requires =
[IS_EMAIL(),IS_NOT_IN_DB(db,'auth_user.email')]),
Field('password', 'password', readable=False, label='Password',
requires=CRYPT(auth.settings.hmac_key)),
Field('registration_key', length=512, writable=False,
readable=False,default=''),
Field('reset_password_key', length=512, writable=False,
readable=False, default=''))


What is the reset_password_key for? I guess I'd better use the latter
table definition, don't I need any validators?


Kind regards,

Annet.


  1   2   3   4   5   6   7   8   9   10   >