Re: [web2py] Re: web2py.gluon.html.XML allowing relative urls

2010-11-24 Thread Michele Comitini
+1


2010/11/24 Jlew jlew.black...@gmail.com:
 Here is a fixed one putting the allowed schemes again.

 diff --git a/gluon/sanitizer.py b/gluon/sanitizer.py
 --- a/gluon/sanitizer.py
 +++ b/gluon/sanitizer.py
 @@ -151,11 +151,12 @@
     def url_is_acceptable(self, url):
         
 -        Requires all URLs to be \absolute.\
 +        Accepts relative and absolute urls
         
         parsed = urlparse(url)
 -        return parsed[0] in self.allowed_schemes and '.' in
 parsed[1]
 +        return (parsed[0] in self.allowed_schemes and '.' in
 parsed[1]) \
 +                or (parsed[0] == '' and parsed[2][0:1]=='/')
     def strip(self, rawstring, escape=True):
         

 On Nov 23, 11:57 pm, Jlew jlew.black...@gmail.com wrote:
 I noticed that the XML module does not allow relative URL's when
 sanitize is set to true.  I would think that local urls would be
 helpful to allow as the web2py URL function produces relative urls.
 It would only make sense to allow relative links. I found a case where
 html links generated from url function and stored in the db would
 later be removed when passed through an XML with sanitize on.

 Searching into the issue I found that this is because the XssCleaner
 in web2py.gluon.sanitizer has a method url_is_acceptable which only
 allows absolute urls.

 Here is a patch that allows relative urls.

 diff --git a/gluon/sanitizer.py b/gluon/sanitizer.py
 --- a/gluon/sanitizer.py
 +++ b/gluon/sanitizer.py
 @@ -151,11 +151,12 @@

      def url_is_acceptable(self, url):
          
 -        Requires all URLs to be \absolute.\
 +        Accepts relative and absolute urls
          

          parsed = urlparse(url)
 -        return parsed[0] in self.allowed_schemes and '.' in parsed[1]
 +        return (parsed[0] in ['http', 'https', 'ftp'] and '.' in
 parsed[1]) \
 +                or (parsed[0] == '' and parsed[2][0:1]=='/')

      def strip(self, rawstring, escape=True):
          


[web2py] working script to install virtualenv and then install and start web2py

2010-11-24 Thread Chris Steel
scripts/setup-virtualenv-web2py.sh in the trunk does not seem to be working.
Here is a replacement that should do the trick on most posix systems.

it downloads virtualenv, installs it, creates a virtual environment
directory and starts the virtual environment in the new directory. Then it
installs the latest version of web2py to the virtual environment and starts
web2py.

Once you complete your web2py session you will want to shut down the virtual
environment by typing 'disactivate' in the terminal, see notes in the script
for details

Seems to work fine on OSX but I have not been running it for very long ;).
Please test.

It could create a directory to hold all the virtual environments, I was
thinking that something like ${HOME}/dev/environments might work, feedback
welcome.

Massimo, please feel free to include in in the trunk as is if you wish or I
could update it to create a directory in the users home directory
automatically

Cheers,

Chris

-- 
Christopher Steel

Voice of Access


setup-virtualenv-install-web2py.sh
Description: Bourne shell script


[web2py] Re: ERP projects

2010-11-24 Thread Rahul
Hey All,
   I have developed a system for Bug Tracking for my organization and
personal use and it uses SQLite as backend. I find it pretty good to
deploy in production environments. The system I have coded uses the
concept of Workspaces. Where each workspace is independent and the
users belonging to that specific workspace are seperate from the other
workspaces/users including the data. If you want to have a look, you
can check it out using a Demo login that is available on the site.
site: www.flockbird.com

btw, I am open to suggestions and improvements for it :)

Cheers, Rahul
www.flockbird.com

On Nov 23, 8:40 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 Our system is called SATLite (Simple Agile Tool - Lite), this is a work in
 progress and is being developed by 4 people, we did't decide yet if we are
 going to serve the app (free for use) or opening the source.

 This is a really tiny and simple tool for keeping track of agile projects
 and its commom tasks, our release plan is for 2011/Jan, because interface
 design/usability is being our most important matter.

 I Guess we'll open the source and also offer it as a free service, and even
 a non-Lite payed version as a service.

 we love to use Rally 
 (http://www.rallydev.com/agile_products/editions/community/), but our goal is
 to abstract more the complexity and offer tools/API for integration.

 2010/11/22 Rahul rahul.dhak...@gmail.com



  Hi Bruno,
       Nice to know that you've written a scrum mgt system in web2py.
  In my organization we use a inhouse tool to manage AGILE development
  using scrum menthods. That is a client server app in .NET. However its
  painfully slow. Is the scrum mgt system you've written open source?

  Cheers, Rahul (www.flockbird.com)

  On Nov 21, 1:00 am, Michele Comitini michele.comit...@gmail.com
  wrote:
   Mariano,

   +1

   This project can be very important to make web2py look even more
   appealing to the business world.
   I would like to help.

   mic

   2010/11/19 Mariano Reingart reing...@gmail.com:

Yes, I agree, development will be done in english, look at this
facturalibre branch:

   http://code.google.com/p/gestionlibre/source/browse/?r=2ecd5bfdd8378b.
  ..

The default branch is a early version migrated from a current
database without translation, just to get something to start with and
to see the whole model, it even doesn't compile.

Anyway, there are terms that doesn't have an exact translation to
english, I'm using whose  have the closest meaning, and help from
anglosaxon accountants (and from other countries too) will be very
useful.

Best regards,

Mariano Reingart
   http://www.sistemasagiles.com.ar
   http://reingart.blogspot.com

On Fri, Nov 19, 2010 at 12:41 PM, Bruno Rocha rochacbr...@gmail.com
  wrote:
Nice! I think I can contribute.
But, One problem I found in your models, is the tables and fields
  being
named in Spanish.  As English is an IT Universal Language, I guess
  some
people will find difficult to mantain, contribute and extend the
  system
because of Spanish models.
I started a Scrum Management System, and when the project was almost
  done, I
figured out that my table names and even function names was in
  Portuguese,
so I started the translation to English.
Think about it.
2010/11/19 Mariano Reingart reing...@gmail.com

We are making anERP-like system too:
   http://code.google.com/p/gestionlibre/source/browse/ABOUT

Initial model is almost done, now I'm focused on basic controllers to
register invoices, receipts and so on (sales)

ThisERPis based on a previous system done in VisualBasic (following
double-entry bookkeeping accounting standards), with a past
  experience
of more than 10 years and around a hundred of clients.

We are looking for interested people, and mainly, we need some
  funding
to develop this app, altought we have the design and prototypes
working, the development is a big effort.

If anyone else is working in similarprojects, maybe we can join or
share experiences,

Best regards

Mariano Reingart
   http://www.sistemasagiles.com.ar
   http://reingart.blogspot.com

On Fri, Nov 19, 2010 at 2:27 AM, mdipierro mdipie...@cs.depaul.edu
wrote:
 am I?

 I want to know more about theERP? Looks like we are going to have 3
 ERPs!

 On Nov 18, 9:53 pm, yamandu yamandu.co...@gmail.com wrote:
 Massimo, you are funny (Yes, you!).

 Should I list theERPI have started as project?

--

Bruno Rocha
   http://about.me/rochacbruno/bio

 --

 Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Get User [auth_user] Janrain

2010-11-24 Thread Andrew Evans
Ok I have gotten a bit further. I think form what I can tell I still need to
define my auth table

now I am getting an error

Traceback (most recent call last):
  File /home/www-data/web2py/gluon/restricted.py, line 188, in restricted
exec ccode in environment
  File /home/www-data/web2py/applications/Working/views/default/index.html,
line 15, in module
  File /home/www-data/web2py/gluon/html.py, line 188, in URL
raise SyntaxError, 'not enough information to build the url'
SyntaxError: not enough information to build the url


Do I need to change some values some where any ideas

*cheers

PS This is my set up so far

# User Registration Information
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=''),
Field('username', length=128, default='', unique=True),
Field('address', length=512, default=''),
   #Field('birthday', 'date'),
Field('password', 'password', length=512,
  readable=False, label='Password'),
Field('registration_key', length=512,
  writable=False, readable=False, default=''),
Field('reset_password_key', length=512,
  writable=False, readable=False, default=''),
Field('registration_id', length=512,
  writable=False, readable=False, default=''))


from gluon.contrib.login_methods.rpx_account import *
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(request,
api_key='',
domain='.',
url = http://domain/%s/default/user/login; % request.application)


Re: [web2py] Re: your assignment freelancer.org

2010-11-24 Thread Branko Vukelic
On Wed, Nov 24, 2010 at 4:16 AM, Richard richar...@gmail.com wrote:
 Is this appropriate for the web2py mailing list? Many students cheat
 on assignments.

It's not really cheating if you actually learn something from the
expert that did your assignment.


-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Name error, but only if I run it in view..

2010-11-24 Thread Ole Martin Maeland
Hi,

That will not work. I just read the output from dict - companies - that is a
query on db.newcomp. So only keys in dict will be the database names - id,
uuid, address. It works for id and uuid, but not for name and address. state
that it is not defined, but it's in the db, it's in the db model. so it's
something else...

but I have no idea..

regards
Ole Martin

def list_companies():
form=crud.create(db.newcomp)
companies=db(db.newcomp.id0).select(orderby=db.newcomp.id)
return dict(companies=companies,form=form)



2010/11/19 Kenneth Lundström kenneth.t.lundst...@gmail.com

  {{for company in companies:}}
  tr
  td{{=uuid}}/td
  td{{=address}}/td
  /tr
 {{pass}}

 Shouldn´t this be like

 td{{=company.uuid}}/td
 td{{=company.address}}/td

 or maybe

 td{{=companies[company].uuid}}/td
 td{{=campanies[company].address}}/td


 Kenneth




-- 
Hilsen
Ole Martin
Mob: 95227471


[web2py] Re: Get User [auth_user] Janrain

2010-11-24 Thread Andrew Evans
Ok I have gone full circle now

How can I get values from janrain into my code? This does not work!

db.define_table('user_extended',
Field('userinfo', db.auth_user, default=auth.user_id, readable=False,
writable=False,unique=True),

I need to change the db.auth_user value but to what? I have removed any set
up of auth now and only have the janrain code as it describes in the
documentation.

Anyway idea what I am doing wrong

*cheers


[web2py] Re: Inserting custom field types broken

2010-11-24 Thread Ishbir
Hey,

Here's the code- http://tinypaste.com/1ec50
Host_Details is a class extended from Storage class.

Workaround:

Use: db(db.plans.id==db.plans.insert(...)).update(info=plan)


On Nov 23, 7:26 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Can you post code to reproduce this. It will save some time and we can
 fix it sooner.

 On Nov 23, 7:53 am, Ishbir ishbi...@gmail.com wrote:

  Hey there,

  There seems to be a bug in web2py which pops up while inserting a
  record to a table with a custom field type.

  How to reproduce:
  - Make a table with a custom field
  - Try inserting a record
  - The record would come out as None
  - Try updating the record with the custom value. It shows this time

  Workaround: First insert the record, then update it with the custom
  value.

  Hope to see this fixed ASAP.




[web2py] Re: Name error, but only if I run it in view..

2010-11-24 Thread villas
I am sure there are better ways of doing it,  but I usually look to
see exactly what is printed in the console by placing a print
statement in my code, something like one of these:

print companies
print BEAUTIFY(companies)
for company in companies: print company

this gives me a clue as to how to address the variables.

Regards,
-D

On Nov 24, 9:58 am, Ole Martin Maeland olemael...@gmail.com wrote:
 Hi,

 That will not work. I just read the output from dict - companies - that is a
 query on db.newcomp. So only keys in dict will be the database names - id,
 uuid, address. It works for id and uuid, but not for name and address. state
 that it is not defined, but it's in the db, it's in the db model. so it's
 something else...

 but I have no idea..

 regards
 Ole Martin

 def list_companies():
     form=crud.create(db.newcomp)
     companies=db(db.newcomp.id0).select(orderby=db.newcomp.id)
     return dict(companies=companies,form=form)

 2010/11/19 Kenneth Lundström kenneth.t.lundst...@gmail.com



   {{for company in companies:}}
   tr
   td{{=uuid}}/td
   td{{=address}}/td
   /tr
  {{pass}}

  Shouldn´t this be like

  td{{=company.uuid}}/td
  td{{=company.address}}/td

  or maybe

  td{{=companies[company].uuid}}/td
  td{{=campanies[company].address}}/td

  Kenneth

 --
 Hilsen
 Ole Martin
 Mob: 95227471


[web2py] Re: ERP projects

2010-11-24 Thread villas
 I know some systems developed in Delphi using Paradox as database
 working for years, now. And they don't imagine what a transaction is. :-(

LOL  yeah,  but I bet they know what a 're-index' means! :)


[web2py] Re: ERP projects

2010-11-24 Thread newnomad
My question was more about what the absolute minimum requirements,
lowest entry barrrier, for a web2py ERP would be. What if the ERP was
to be used by an organisation that doesnt have a budget for a VPS yet,
it would be great if they could start using it on the free GAE, maybe
not perfect, but it works. Once they organisation grows, they can
still rent a VPS, but even then they might prefer a scalable PAAS
solution.
Will web2py ERP's work on GAE out of the box?

On Nov 23, 4:33 pm, Vinicius Assef vinicius...@gmail.com wrote:
 +1

 If we just use DAL, we can count on web2py's transaction management to
 make the app portable among supported databases.

 So, Sqlite may be used in development and testing environments.
 If you want to run in a really small business, Sqlite could be acceptable, 
 too.

 I know some systems developed in Delphi using Paradox as database
 working for years, now.
 And they don't imagine what a transaction is. :-(

 --
 Vinicius Assef.

 On Tue, Nov 23, 2010 at 1:20 PM, Michele Comitini



 michele.comit...@gmail.com wrote:
  I agree, it is true that in many little environments, there is only
  one person writing and a few reading so sqlite would be
  more than enough.

  2010/11/23 mdipierro mdipie...@cs.depaul.edu:
  yes it should use dal and work with all supported databases, yet I
  would not run an ERP on a system without transactions.

  On Nov 23, 9:07 am, Michele Comitini michele.comit...@gmail.com
  wrote:
  IMHO the question is not about having a database, the question is that
  the ERP must
  use only DAL for data management and must run on any supported
  database not only relational ones.

  mic

  2010/11/23 mdipierro mdipie...@cs.depaul.edu:

   I think a relational database for an ERP is a must and those ERPs all
   support them.
   At the university we have peoplesoft+oracle and ~30,000 users. Turns
   out the ERP is not a high traffic app and it runs on one VPS (with
   replication for high availability). I am sure any web2py ERP will be
   just fine on a VPS with postgresql.

   Massimo

   On Nov 23, 8:14 am, newnomad uti...@gmail.com wrote:
   It's really great that there are 3 ERP's in the works, I'd love to
   switch from tryton to a web2py based system;

  http://code.google.com/p/gestionlibre/https://bitbucket.org/yamandu/y...
   and a number 3 which I cannot find...

   However will any of those ever work without a relational database, or
   doesn't it make any sense at all for an ERP to work without one?
   If postgre is an absolute must, what are the recommended PAAS/cloud
   options?
   - amazon ec2
   - Google App Engine for 
   businesshttp://code.google.com/appengine/business/

   An alternate solution may be to use mysql, so that it's still easy to
   deploy web2py on a shared lamp host with phyton enabled, but without
   shell access.


[web2py] Re: where to place sizes (and other properties) ?

2010-11-24 Thread annet
Hi Stef,

The problem with most layouts is that they are build in applications
like Adobe's Dreamweaver. I do have CS5 but I prefer to build a layout
in textedit, html and css in separate files using for instance ez_css
for sizing and positioning, which reduces the number of css selectors
significantly.

I only use the style tag for views that need customization on view
level, and inline styles to take care of small adjustments on element
level. However, when your views are well designed, you hardly need the
style tag and inline style attribute to style your views.


Kind regards,

Annet.


Re: [web2py] Re: very long wait for http://127.0.0.1:8000/ on IE and Firefox browsers

2010-11-24 Thread Phyo Arkar
I haven't tried DEFAULT_MAX_THREADS it yet but to report that it is not just
windows problem it happens in Linux too.
WHen i test my Homepage which dont do anything dynamic much , just login box
, with static js and css. That caused long load delays too.

Tim , sorry to know that u got injury. Had you recovered well now?


On Wed, Nov 24, 2010 at 12:01 PM, Jonathan Lundell jlund...@pobox.comwrote:

 On Nov 23, 2010, at 8:48 PM, Anthony wrote:
 
  On Nov 23, 9:26 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Nov 23, 8:10 pm, Timbo tfarr...@owassobible.org wrote:
  Set numthreads=0 in your options.py.  See if you still see this
  behavior.
 
  options.py is just for running web2py as a Windows service, no? I'm
  not running web2py as a Windows service when I observe the problem.
 
  If you're running from the command line, use --options 0.
 
  Do you mean use the -n command line option to set numthreads to 0,
  e.g.:
 
python web2py.py -a password -i 127.0.0.1 -p 8000 -n 0
 
  I tried this, but in that case, I can't get 127.0.0.1:8000 to load at
  all (it just hangs indefinitely).

 Right, now that I look at it, there's no way to override max_threads. Maybe
 there should be


Re: [web2py] Re: your assignment freelancer.org

2010-11-24 Thread Kuba Kucharski
guys, I think that was intended as sarcasm by Massimo..
stay cool ;)

-- 
Kuba


[web2py] Re: Get User [auth_user] Janrain

2010-11-24 Thread mdipierro
I think you are missing auth.define_tables() somewhere

On Nov 24, 12:44 am, Andrew Evans randra...@gmail.com wrote:
 Hello I just set up Janrain using the following

 from gluon.contrib.login_methods.rpx_account import RPXAccount
 auth.settings.actions_disabled=['register','change_password','request_reset_password']
 auth.settings.login_form = RPXAccount(request,
     api_key='',
     domain='..',
     url = http://localhost/%s/default/user/login; % request.application)

 I am trying to switch to using Janrain for my app

 However I do not know how to get the auth_user field so I can refernce it in
 some of my database fields for example

 db.define_table('product',
     Field('userinfo', db.auth_user, default=auth.user_id, readable=False,
 writable=False),

 I get an a key error in web2py *confused

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/restricted.py, line 188, in restricted
     exec ccode in environment
   File /home/www-data/web2py/applications/Working/models/db.py
 https://www.suck-o.de/admin/default/edit/Working/models/db.py, line
 72, in module
     Field('userinfo', db.auth_user, default=auth.user_id,
 readable=False, writable=False),
   File /home/www-data/web2py/gluon/sql.py, line 1391, in __getattr__
     return dict.__getitem__(self,key)
 KeyError: 'auth_user'

 any ideas *cheers

 and ty :D


Re: [web2py] Re: your assignment freelancer.org

2010-11-24 Thread Phyo Arkar
umm still it is an assignment lol , yeah and only 20$ worth haha :D

On Wed, Nov 24, 2010 at 8:32 PM, Kuba Kucharski kuba.kuchar...@gmail.comwrote:

 guys, I think that was intended as sarcasm by Massimo..
 stay cool ;)

 --
 Kuba



[web2py] Re: ERP projects

2010-11-24 Thread mdipierro
If an organization cannot afford $20/month for a VPS they should
attempt to use a ERP.

On Nov 24, 6:49 am, newnomad uti...@gmail.com wrote:
 My question was more about what the absolute minimum requirements,
 lowest entry barrrier, for a web2py ERP would be. What if the ERP was
 to be used by an organisation that doesnt have a budget for a VPS yet,
 it would be great if they could start using it on the free GAE, maybe
 not perfect, but it works. Once they organisation grows, they can
 still rent a VPS, but even then they might prefer a scalable PAAS
 solution.
 Will web2py ERP's work on GAE out of the box?

 On Nov 23, 4:33 pm, Vinicius Assef vinicius...@gmail.com wrote:

  +1

  If we just use DAL, we can count on web2py's transaction management to
  make the app portable among supported databases.

  So, Sqlite may be used in development and testing environments.
  If you want to run in a really small business, Sqlite could be acceptable, 
  too.

  I know some systems developed in Delphi using Paradox as database
  working for years, now.
  And they don't imagine what a transaction is. :-(

  --
  Vinicius Assef.

  On Tue, Nov 23, 2010 at 1:20 PM, Michele Comitini

  michele.comit...@gmail.com wrote:
   I agree, it is true that in many little environments, there is only
   one person writing and a few reading so sqlite would be
   more than enough.

   2010/11/23 mdipierro mdipie...@cs.depaul.edu:
   yes it should use dal and work with all supported databases, yet I
   would not run an ERP on a system without transactions.

   On Nov 23, 9:07 am, Michele Comitini michele.comit...@gmail.com
   wrote:
   IMHO the question is not about having a database, the question is that
   the ERP must
   use only DAL for data management and must run on any supported
   database not only relational ones.

   mic

   2010/11/23 mdipierro mdipie...@cs.depaul.edu:

I think a relational database for an ERP is a must and those ERPs all
support them.
At the university we have peoplesoft+oracle and ~30,000 users. Turns
out the ERP is not a high traffic app and it runs on one VPS (with
replication for high availability). I am sure any web2py ERP will be
just fine on a VPS with postgresql.

Massimo

On Nov 23, 8:14 am, newnomad uti...@gmail.com wrote:
It's really great that there are 3 ERP's in the works, I'd love to
switch from tryton to a web2py based system;

   http://code.google.com/p/gestionlibre/https://bitbucket.org/yamandu/y...
and a number 3 which I cannot find...

However will any of those ever work without a relational database, or
doesn't it make any sense at all for an ERP to work without one?
If postgre is an absolute must, what are the recommended PAAS/cloud
options?
- amazon ec2
- Google App Engine for 
businesshttp://code.google.com/appengine/business/

An alternate solution may be to use mysql, so that it's still easy to
deploy web2py on a shared lamp host with phyton enabled, but without
shell access.




[web2py] Re: about cron tasks

2010-11-24 Thread villas
Hi António

Test your script thoroughly on the commandline first.  You can run the
script in the environment of your app.  See commandline options for
running scripts in http://web2py.com/book/default/chapter/04

In addition to running the whole script,  you can debug sections of
your code by opening up a commandline with something like this:

python web2py.py -S yourapp -M -N

If you want to log results of your scripts,  consider writing them to
a log file or a DB.  Be careful when using cron not to start too many
processes, it is often better to run one script with a continuous loop
to prevent this.  It is described in the book.  I notice that cron
sometimes seems to lock sqlite,  but that's probably my badly written
test code rather than a bug  :)

Regards,
-D



On Nov 23, 11:15 pm, António Ramos ramstei...@gmail.com wrote:
 Print in a script called by cron does not print to web2py console.
 At least in my windows machine.
 Also i read the book and the examples of cron points to files in the file
 system forgetting the application folder.

 I think cron tasks should be in the application path and inside cron folder
 or other for that purpose. Also in admin there should be available all cron
 tasks to be edited by editpad.

 Right?

 Best regards
 António

 Em 22 de novembro de 2010 15:34, António Ramos ramstei...@gmail.comescreveu:

  I my pc it does not print.
  Also the path to the script have to include the absolute path?
  Can it be a controller script?

  Antonio

  2010/11/22 Vinicius Assef vinicius...@gmail.com

  2010/11/19 António Ramos ramstei...@gmail.com:
   Hello, can cron tasks write output to web2py console?

  Just use print command.




Re: [web2py] is_in_db error message translation

2010-11-24 Thread Richard Vézina
I need to translate IS_IN_DB Validator message.

Richard

On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef vinicius...@gmail.comwrote:

 Are you getting some error message?


 On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
 ml.richard.vez...@gmail.com wrote:
  Hello,
  I try this :
  db.table1.field1.requires=\
 
 
  IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
  not available'))
  But not working...
  How may I translate the IS_IN_DB error message?
  Should we have an other attribute for IS_IN_DB function?
  Richard



[web2py] Re: ERP projects

2010-11-24 Thread newnomad

I know what you mean, but maybe it's a mom and dad basement business.
They will probably use http://www.myerp.com/ then, free for up to 2
users. Once they grow they will stay there and pay, and have forgotten
about web2py...
I think the 'free' entry is always good to start out.
So regardless of personal convictions, can ERP's use the DAL with only
GAE?


On Nov 24, 3:09 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 If an organization cannot afford $20/month for a VPS they should
 attempt to use a ERP.

 On Nov 24, 6:49 am, newnomad uti...@gmail.com wrote:



  My question was more about what the absolute minimum requirements,
  lowest entry barrrier, for a web2py ERP would be. What if the ERP was
  to be used by an organisation that doesnt have a budget for a VPS yet,
  it would be great if they could start using it on the free GAE, maybe
  not perfect, but it works. Once they organisation grows, they can
  still rent a VPS, but even then they might prefer a scalable PAAS
  solution.
  Will web2py ERP's work on GAE out of the box?

  On Nov 23, 4:33 pm, Vinicius Assef vinicius...@gmail.com wrote:

   +1

   If we just use DAL, we can count on web2py's transaction management to
   make the app portable among supported databases.

   So, Sqlite may be used in development and testing environments.
   If you want to run in a really small business, Sqlite could be 
   acceptable, too.

   I know some systems developed in Delphi using Paradox as database
   working for years, now.
   And they don't imagine what a transaction is. :-(

   --
   Vinicius Assef.

   On Tue, Nov 23, 2010 at 1:20 PM, Michele Comitini

   michele.comit...@gmail.com wrote:
I agree, it is true that in many little environments, there is only
one person writing and a few reading so sqlite would be
more than enough.

2010/11/23 mdipierro mdipie...@cs.depaul.edu:
yes it should use dal and work with all supported databases, yet I
would not run an ERP on a system without transactions.

On Nov 23, 9:07 am, Michele Comitini michele.comit...@gmail.com
wrote:
IMHO the question is not about having a database, the question is that
the ERP must
use only DAL for data management and must run on any supported
database not only relational ones.

mic

2010/11/23 mdipierro mdipie...@cs.depaul.edu:

 I think a relational database for an ERP is a must and those ERPs 
 all
 support them.
 At the university we have peoplesoft+oracle and ~30,000 users. Turns
 out the ERP is not a high traffic app and it runs on one VPS (with
 replication for high availability). I am sure any web2py ERP will be
 just fine on a VPS with postgresql.

 Massimo

 On Nov 23, 8:14 am, newnomad uti...@gmail.com wrote:
 It's really great that there are 3 ERP's in the works, I'd love to
 switch from tryton to a web2py based system;

http://code.google.com/p/gestionlibre/https://bitbucket.org/yamandu/y...
 and a number 3 which I cannot find...

 However will any of those ever work without a relational database, 
 or
 doesn't it make any sense at all for an ERP to work without one?
 If postgre is an absolute must, what are the recommended PAAS/cloud
 options?
 - amazon ec2
 - Google App Engine for 
 businesshttp://code.google.com/appengine/business/

 An alternate solution may be to use mysql, so that it's still easy 
 to
 deploy web2py on a shared lamp host with phyton enabled, but 
 without
 shell access.


[web2py] Re: is_in_db error message translation

2010-11-24 Thread mdipierro
Can you translate other strings? Do other T(...) messages get
translated?

On Nov 24, 8:27 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 I need to translate IS_IN_DB Validator message.

 Richard

 On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef vinicius...@gmail.comwrote:

  Are you getting some error message?

  On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
  ml.richard.vez...@gmail.com wrote:
   Hello,
   I try this :
   db.table1.field1.requires=\

   IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
   not available'))
   But not working...
   How may I translate the IS_IN_DB error message?
   Should we have an other attribute for IS_IN_DB function?
   Richard




Re: [web2py] Re: is_in_db error message translation

2010-11-24 Thread Richard Vézina
Yes no problem for translation... I just search the way to translate the
IS_IN_DB error message.

I proceed like this for other validator :

IS_NOT_EMPTY(error_message=T('my_translate_massage'))

If there is an other more general way to do it I am open to any idea...

validator message not translate by default...

Richard

On Wed, Nov 24, 2010 at 9:38 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Can you translate other strings? Do other T(...) messages get
 translated?

 On Nov 24, 8:27 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  I need to translate IS_IN_DB Validator message.
 
  Richard
 
  On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef vinicius...@gmail.com
 wrote:
 
   Are you getting some error message?
 
   On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
   ml.richard.vez...@gmail.com wrote:
Hello,
I try this :
db.table1.field1.requires=\
 
  
  IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
not available'))
But not working...
How may I translate the IS_IN_DB error message?
Should we have an other attribute for IS_IN_DB function?
Richard
 
 



Re: [web2py] Re: How could I send a email to every members?

2010-11-24 Thread Thadeus Burgess
the problem with mail.send is it creates a brand new connection to the SMTP
server *every* single time you call it.

If you are sending more than 10 emails at a time this will not be efficient
and will take an unnecessary amount of time to complete.

I would suggest dropping down to using base smtplib so you can send
everything through a single connection. Keep in mind when doing this certain
SMTP servers have limits on how many emails can be sent (500 by default) so
you would need to re-establish your connection after this cutoff point.

--
Thadeus




On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote:

 Hi David,

 I have a crm app from which I send html mails using the following
 function:

 def mail():
m_list=db(...).select(...)
for item in m_list:
context=dict(item=item)
message=response.render('mail/mail.html',context)
recipient=item.email

 boolean=mail.send(to=[recipient],subject='...',message=[None,message])
if boolean:
db.mailingstats.insert(...)
else:
db.adminstats.insert(...)
return True

 The boolean stuff isn't a necessity but it gives me feedback on the
 process, and I use the mailingstats table for statistical purposes.

 If you're sending html mails make sure the layout is all tables, and
 put the css in the body not in the head. If you need an example I'll
 post a view.


 Kind regards,

 Annet.



[web2py] Re: How could I send a email to every members?

2010-11-24 Thread mdipierro
I agree + queue emails and have a background process send them.

On Nov 24, 8:50 am, Thadeus Burgess thade...@thadeusb.com wrote:
 the problem with mail.send is it creates a brand new connection to the SMTP
 server *every* single time you call it.

 If you are sending more than 10 emails at a time this will not be efficient
 and will take an unnecessary amount of time to complete.

 I would suggest dropping down to using base smtplib so you can send
 everything through a single connection. Keep in mind when doing this certain
 SMTP servers have limits on how many emails can be sent (500 by default) so
 you would need to re-establish your connection after this cutoff point.

 --
 Thadeus

 On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote:
  Hi David,

  I have a crm app from which I send html mails using the following
  function:

  def mail():
     m_list=db(...).select(...)
     for item in m_list:
         context=dict(item=item)
         message=response.render('mail/mail.html',context)
         recipient=item.email

  boolean=mail.send(to=[recipient],subject='...',message=[None,message])
         if boolean:
             db.mailingstats.insert(...)
         else:
             db.adminstats.insert(...)
     return True

  The boolean stuff isn't a necessity but it gives me feedback on the
  process, and I use the mailingstats table for statistical purposes.

  If you're sending html mails make sure the layout is all tables, and
  put the css in the body not in the head. If you need an example I'll
  post a view.

  Kind regards,

  Annet.




[web2py] Re: is_in_db error message translation

2010-11-24 Thread mdipierro
IS_IN_DB should work as any other validator. Which language is your
browser is to?
Do you see the string ''value not available' when you edit the
corresponding language file?

On Nov 24, 8:42 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 Yes no problem for translation... I just search the way to translate the
 IS_IN_DB error message.

 I proceed like this for other validator :

 IS_NOT_EMPTY(error_message=T('my_translate_massage'))

 If there is an other more general way to do it I am open to any idea...

 validator message not translate by default...

 Richard

 On Wed, Nov 24, 2010 at 9:38 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  Can you translate other strings? Do other T(...) messages get
  translated?

  On Nov 24, 8:27 am, Richard Vézina ml.richard.vez...@gmail.com
  wrote:
   I need to translate IS_IN_DB Validator message.

   Richard

   On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef vinicius...@gmail.com
  wrote:

Are you getting some error message?

On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
ml.richard.vez...@gmail.com wrote:
 Hello,
 I try this :
 db.table1.field1.requires=\

   IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
 not available'))
 But not working...
 How may I translate the IS_IN_DB error message?
 Should we have an other attribute for IS_IN_DB function?
 Richard




[web2py] Re: web2py.gluon.html.XML allowing relative urls

2010-11-24 Thread mdipierro
uploading to trunk.

On Nov 23, 11:10 pm, Jlew jlew.black...@gmail.com wrote:
 Here is a fixed one putting the allowed schemes again.

 diff --git a/gluon/sanitizer.py b/gluon/sanitizer.py
 --- a/gluon/sanitizer.py
 +++ b/gluon/sanitizer.py
 @@ -151,11 +151,12 @@
      def url_is_acceptable(self, url):
          
 -        Requires all URLs to be \absolute.\
 +        Accepts relative and absolute urls
          
          parsed = urlparse(url)
 -        return parsed[0] in self.allowed_schemes and '.' in
 parsed[1]
 +        return (parsed[0] in self.allowed_schemes and '.' in
 parsed[1]) \
 +                or (parsed[0] == '' and parsed[2][0:1]=='/')
      def strip(self, rawstring, escape=True):
          

 On Nov 23, 11:57 pm, Jlew jlew.black...@gmail.com wrote:

  I noticed that the XML module does not allow relative URL's when
  sanitize is set to true.  I would think that local urls would be
  helpful to allow as the web2py URL function produces relative urls.
  It would only make sense to allow relative links. I found a case where
  html links generated from url function and stored in the db would
  later be removed when passed through an XML with sanitize on.

  Searching into the issue I found that this is because the XssCleaner
  in web2py.gluon.sanitizer has a method url_is_acceptable which only
  allows absolute urls.

  Here is a patch that allows relative urls.

  diff --git a/gluon/sanitizer.py b/gluon/sanitizer.py
  --- a/gluon/sanitizer.py
  +++ b/gluon/sanitizer.py
  @@ -151,11 +151,12 @@

       def url_is_acceptable(self, url):
           
  -        Requires all URLs to be \absolute.\
  +        Accepts relative and absolute urls
           

           parsed = urlparse(url)
  -        return parsed[0] in self.allowed_schemes and '.' in parsed[1]
  +        return (parsed[0] in ['http', 'https', 'ftp'] and '.' in
  parsed[1]) \
  +                or (parsed[0] == '' and parsed[2][0:1]=='/')

       def strip(self, rawstring, escape=True):
           




Re: [web2py] Re: is_in_db error message translation

2010-11-24 Thread Richard Vézina
No I don't see any validators messages in fr-ca.py.

My browser is set to fr-ca or fr-fr. Both aren't updated with validators
messages when I get those error.

Richard



On Wed, Nov 24, 2010 at 10:09 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 IS_IN_DB should work as any other validator. Which language is your
 browser is to?
 Do you see the string ''value not available' when you edit the
 corresponding language file?

 On Nov 24, 8:42 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  Yes no problem for translation... I just search the way to translate the
  IS_IN_DB error message.
 
  I proceed like this for other validator :
 
  IS_NOT_EMPTY(error_message=T('my_translate_massage'))
 
  If there is an other more general way to do it I am open to any idea...
 
  validator message not translate by default...
 
  Richard
 
  On Wed, Nov 24, 2010 at 9:38 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   Can you translate other strings? Do other T(...) messages get
   translated?
 
   On Nov 24, 8:27 am, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
I need to translate IS_IN_DB Validator message.
 
Richard
 
On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef 
 vinicius...@gmail.com
   wrote:
 
 Are you getting some error message?
 
 On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
 ml.richard.vez...@gmail.com wrote:
  Hello,
  I try this :
  db.table1.field1.requires=\
 
  
  IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
  not available'))
  But not working...
  How may I translate the IS_IN_DB error message?
  Should we have an other attribute for IS_IN_DB function?
  Richard
 
 



[web2py] Re: working script to install virtualenv and then install and start web2py

2010-11-24 Thread mdipierro
in trunk

On Nov 24, 2:49 am, Chris Steel chris.st...@gmail.com wrote:
 scripts/setup-virtualenv-web2py.sh in the trunk does not seem to be working.
 Here is a replacement that should do the trick on most posix systems.

 it downloads virtualenv, installs it, creates a virtual environment
 directory and starts the virtual environment in the new directory. Then it
 installs the latest version of web2py to the virtual environment and starts
 web2py.

 Once you complete your web2py session you will want to shut down the virtual
 environment by typing 'disactivate' in the terminal, see notes in the script
 for details

 Seems to work fine on OSX but I have not been running it for very long ;).
 Please test.

 It could create a directory to hold all the virtual environments, I was
 thinking that something like ${HOME}/dev/environments might work, feedback
 welcome.

 Massimo, please feel free to include in in the trunk as is if you wish or I
 could update it to create a directory in the users home directory
 automatically

 Cheers,

 Chris

 --
 Christopher Steel

 Voice of Access

  setup-virtualenv-install-web2py.sh
 3KViewDownload


[web2py] Re: is_in_db error message translation

2010-11-24 Thread mdipierro
Yes, when you get those messages, the language files should be
overwritten and then you need to go in and manually translate them. If
the string is not there or it is not translated, then you do not get
the message translated.

Check the file timestamp. Is the file being updated?
Check the file permissions. Has your app permission to overwrite it?
Try force it... press the update_languages button. Any change?

On Nov 24, 9:23 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 No I don't see any validators messages in fr-ca.py.

 My browser is set to fr-ca or fr-fr. Both aren't updated with validators
 messages when I get those error.

 Richard

 On Wed, Nov 24, 2010 at 10:09 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  IS_IN_DB should work as any other validator. Which language is your
  browser is to?
  Do you see the string ''value not available' when you edit the
  corresponding language file?

  On Nov 24, 8:42 am, Richard Vézina ml.richard.vez...@gmail.com
  wrote:
   Yes no problem for translation... I just search the way to translate the
   IS_IN_DB error message.

   I proceed like this for other validator :

   IS_NOT_EMPTY(error_message=T('my_translate_massage'))

   If there is an other more general way to do it I am open to any idea...

   validator message not translate by default...

   Richard

   On Wed, Nov 24, 2010 at 9:38 AM, mdipierro mdipie...@cs.depaul.edu
  wrote:
Can you translate other strings? Do other T(...) messages get
translated?

On Nov 24, 8:27 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 I need to translate IS_IN_DB Validator message.

 Richard

 On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef 
  vinicius...@gmail.com
wrote:

  Are you getting some error message?

  On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
  ml.richard.vez...@gmail.com wrote:
   Hello,
   I try this :
   db.table1.field1.requires=\

   IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
   not available'))
   But not working...
   How may I translate the IS_IN_DB error message?
   Should we have an other attribute for IS_IN_DB function?
   Richard




[web2py] Re: How could I send a email to every members?

2010-11-24 Thread mart
I'd like to see that table layout Annet has :)

Annet, is that ok ?

Thanks,

Mart :)

On Nov 24, 10:05 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I agree + queue emails and have a background process send them.

 On Nov 24, 8:50 am, Thadeus Burgess thade...@thadeusb.com wrote:

  the problem with mail.send is it creates a brand new connection to the SMTP
  server *every* single time you call it.

  If you are sending more than 10 emails at a time this will not be efficient
  and will take an unnecessary amount of time to complete.

  I would suggest dropping down to using base smtplib so you can send
  everything through a single connection. Keep in mind when doing this certain
  SMTP servers have limits on how many emails can be sent (500 by default) so
  you would need to re-establish your connection after this cutoff point.

  --
  Thadeus

  On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote:
   Hi David,

   I have a crm app from which I send html mails using the following
   function:

   def mail():
      m_list=db(...).select(...)
      for item in m_list:
          context=dict(item=item)
          message=response.render('mail/mail.html',context)
          recipient=item.email

   boolean=mail.send(to=[recipient],subject='...',message=[None,message])
          if boolean:
              db.mailingstats.insert(...)
          else:
              db.adminstats.insert(...)
      return True

   The boolean stuff isn't a necessity but it gives me feedback on the
   process, and I use the mailingstats table for statistical purposes.

   If you're sending html mails make sure the layout is all tables, and
   put the css in the body not in the head. If you need an example I'll
   post a view.

   Kind regards,

   Annet.




Re: [web2py] Re: very long wait for http://127.0.0.1:8000/ on IE and Firefox browsers

2010-11-24 Thread Jonathan Lundell
On Nov 24, 2010, at 5:59 AM, Phyo Arkar wrote:
 I haven't tried DEFAULT_MAX_THREADS it yet but to report that it is not just 
 windows problem it happens in Linux too.
 WHen i test my Homepage which dont do anything dynamic much , just login box 
 , with static js and css. That caused long load delays too.

By all means give max-threads a try. If the problem is thread starvation, it's 
not likely to be Windows-specific. The default limit is 10, which isn't a lot 
for pages with a lot of resources.

 
 Tim , sorry to know that u got injury. Had you recovered well now?
 
 
 On Wed, Nov 24, 2010 at 12:01 PM, Jonathan Lundell jlund...@pobox.com wrote:
 On Nov 23, 2010, at 8:48 PM, Anthony wrote:
 
  On Nov 23, 9:26 pm, Jonathan Lundell jlund...@pobox.com wrote:
  On Nov 23, 8:10 pm, Timbo tfarr...@owassobible.org wrote:
  Set numthreads=0 in your options.py.  See if you still see this
  behavior.
 
  options.py is just for running web2py as a Windows service, no? I'm
  not running web2py as a Windows service when I observe the problem.
 
  If you're running from the command line, use --options 0.
 
  Do you mean use the -n command line option to set numthreads to 0,
  e.g.:
 
python web2py.py -a password -i 127.0.0.1 -p 8000 -n 0
 
  I tried this, but in that case, I can't get 127.0.0.1:8000 to load at
  all (it just hangs indefinitely).
 
 Right, now that I look at it, there's no way to override max_threads. Maybe 
 there should be
 




[web2py] detect user login

2010-11-24 Thread Richard Vézina
Hello

I need to have a response.flash on index page at login but not when the user
come back on index page during a session. I try to user session.counter but
the session is not reset until the cookies are erase I think.

Here my index controller (*not working*) :

def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and session.counter=0:
response.flash = DIV(T('Hello ')+str(auth.user and
auth.user.first_name),BR(),T('Welcome on the '),appTitle)
elif session.counter0:
pass
else:
response.flash = T('Hello')
return dict(message=T(''))

Richard


Re: [web2py] Re: is_in_db error message translation

2010-11-24 Thread Richard Vézina
Ok, I got it to work by adding error_message=myerrromessage in IS_IN_DB()

Thanks

Richard

On Wed, Nov 24, 2010 at 10:29 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 Yes, when you get those messages, the language files should be
 overwritten and then you need to go in and manually translate them. If
 the string is not there or it is not translated, then you do not get
 the message translated.

 Check the file timestamp. Is the file being updated?
 Check the file permissions. Has your app permission to overwrite it?
 Try force it... press the update_languages button. Any change?

 On Nov 24, 9:23 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  No I don't see any validators messages in fr-ca.py.
 
  My browser is set to fr-ca or fr-fr. Both aren't updated with validators
  messages when I get those error.
 
  Richard
 
  On Wed, Nov 24, 2010 at 10:09 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   IS_IN_DB should work as any other validator. Which language is your
   browser is to?
   Do you see the string ''value not available' when you edit the
   corresponding language file?
 
   On Nov 24, 8:42 am, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
Yes no problem for translation... I just search the way to translate
 the
IS_IN_DB error message.
 
I proceed like this for other validator :
 
IS_NOT_EMPTY(error_message=T('my_translate_massage'))
 
If there is an other more general way to do it I am open to any
 idea...
 
validator message not translate by default...
 
Richard
 
On Wed, Nov 24, 2010 at 9:38 AM, mdipierro mdipie...@cs.depaul.edu
   wrote:
 Can you translate other strings? Do other T(...) messages get
 translated?
 
 On Nov 24, 8:27 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  I need to translate IS_IN_DB Validator message.
 
  Richard
 
  On Tue, Nov 23, 2010 at 11:07 PM, Vinicius Assef 
   vinicius...@gmail.com
 wrote:
 
   Are you getting some error message?
 
   On Tue, Nov 23, 2010 at 7:43 PM, Richard Vézina
   ml.richard.vez...@gmail.com wrote:
Hello,
I try this :
db.table1.field1.requires=\
 
  
  IS_IN_DB(db,'othertable.field1',orderby=('field1'),error_message=T('value
not available'))
But not working...
How may I translate the IS_IN_DB error message?
Should we have an other attribute for IS_IN_DB function?
Richard
 
 



[web2py] Re: detect user login

2010-11-24 Thread mdipierro
how about something like this?

auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
'+appTitle')

def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and session.counter=0:
pass
elif session.counter0:
pass
else:
if not response.flash: response.flash = T('Hello')
return dict(message=T(''))

On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 Hello

 I need to have a response.flash on index page at login but not when the user
 come back on index page during a session. I try to user session.counter but
 the session is not reset until the cookies are erase I think.

 Here my index controller (*not working*) :

 def index():
     
     Index page
     
     session.counter = (session.counter or 0) + 1
     if auth.user and auth.user.first_name!=0 and session.counter=0:
         response.flash = DIV(T('Hello ')+str(auth.user and
 auth.user.first_name),BR(),T('Welcome on the '),appTitle)
     elif session.counter0:
         pass
     else:
         response.flash = T('Hello')
     return dict(message=T(''))

 Richard


[web2py] Viewing tickets on GAE devserver

2010-11-24 Thread Narendran
Hello,
I've deployed a Web2Py app on the GAE, and it works fine. I'm trying
to run web2py now on my local machine using GAE's devserver, and due
to some reason, I keep getting a Web2py error ticket. Now the problem
is I am not able to open the tkt due to lack of SSL. Is there some way
I can see the tickets?
And also, how do I see the error tickets on the prod GAE instance?
Couldn't find much material around this. Pointers would be
appreciated.

--
Thanks
Narendran


Re: [web2py] Re: Get User [auth_user] Janrain

2010-11-24 Thread Andrew Evans
Hello ty for the reply I created the auth_user table

but now I get this error when I try to access my login area

any ideas

*cheers

Traceback (most recent call last):
  File /home/www-data/web2py/gluon/restricted.py, line 188, in restricted
exec ccode in environment
  File /home/www-data/web2py/applications/Working/controllers/default.py
https://www.suck-o.de/admin/default/edit/Working/controllers/default.py,
line 190, in module
  File /home/www-data/web2py/gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File /home/www-data/web2py/applications/Working/controllers/default.py
https://www.suck-o.de/admin/default/edit/Working/controllers/default.py,
line 169, in user
return dict(form = auth())
  File /home/www-data/web2py/gluon/tools.py, line 1023, in __call__
return self.login()
  File /home/www-data/web2py/gluon/tools.py, line 1348, in login
elif 'username' in table_user.fields:
AttributeError: 'NoneType' object has no attribute 'fields'


[web2py] Re: very long wait for http://127.0.0.1:8000/ on IE and Firefox browsers

2010-11-24 Thread Timbo
I didn't mean to imply that the enhancements I'm planning for 1.2
(window speed) address this issue...just to be clear.

@Jonathan: Yes we need to make numthreads map to max-threads and
default it to 0 (unlimited) or a very high number.  The only time
reasonable to change this is when running web2py (rocket) on Jython.
See:

http://packages.python.org/rocket/usage.html#architecture-considerations

@Phyo: Thanks.  I'm not fully recovered, but enough to get back in the
game.

-tim

On Nov 24, 9:56 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Nov 24, 2010, at 5:59 AM, Phyo Arkar wrote:

  I haven't tried DEFAULT_MAX_THREADS it yet but to report that it is not 
  just windows problem it happens in Linux too.
  WHen i test my Homepage which dont do anything dynamic much , just login 
  box , with static js and css. That caused long load delays too.

 By all means give max-threads a try. If the problem is thread starvation, 
 it's not likely to be Windows-specific. The default limit is 10, which isn't 
 a lot for pages with a lot of resources.









  Tim , sorry to know that u got injury. Had you recovered well now?

  On Wed, Nov 24, 2010 at 12:01 PM, Jonathan Lundell jlund...@pobox.com 
  wrote:
  On Nov 23, 2010, at 8:48 PM, Anthony wrote:

   On Nov 23, 9:26 pm, Jonathan Lundell jlund...@pobox.com wrote:
   On Nov 23, 8:10 pm, Timbo tfarr...@owassobible.org wrote:
   Set numthreads=0 in your options.py.  See if you still see this
   behavior.

   options.py is just for running web2py as a Windows service, no? I'm
   not running web2py as a Windows service when I observe the problem.

   If you're running from the command line, use --options 0.

   Do you mean use the -n command line option to set numthreads to 0,
   e.g.:

     python web2py.py -a password -i 127.0.0.1 -p 8000 -n 0

   I tried this, but in that case, I can't get 127.0.0.1:8000 to load at
   all (it just hangs indefinitely).

  Right, now that I look at it, there's no way to override max_threads. Maybe 
  there should be


Re: [web2py] Re: detect user login

2010-11-24 Thread Richard Vézina
How do I get the auth.messages.logged_in in response.flash only at login?

I try many different things without success.

Is auth.messages.logged_in as to be put in auth form controller?

On Wed, Nov 24, 2010 at 11:18 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 how about something like this?

 auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
 '+appTitle')

 def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and session.counter=0:
 pass
 elif session.counter0:
pass
else:
 if not response.flash: response.flash = T('Hello')
return dict(message=T(''))

 On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  Hello
 
  I need to have a response.flash on index page at login but not when the
 user
  come back on index page during a session. I try to user session.counter
 but
  the session is not reset until the cookies are erase I think.
 
  Here my index controller (*not working*) :
 
  def index():
  
  Index page
  
  session.counter = (session.counter or 0) + 1
  if auth.user and auth.user.first_name!=0 and session.counter=0:
  response.flash = DIV(T('Hello ')+str(auth.user and
  auth.user.first_name),BR(),T('Welcome on the '),appTitle)
  elif session.counter0:
  pass
  else:
  response.flash = T('Hello')
  return dict(message=T(''))
 
  Richard



[web2py] Re: detect user login

2010-11-24 Thread mdipierro
Well be used to set the flash immediately after login. You can put it
anywere you want (models or same controller as user action) and should
work.

On Nov 24, 10:56 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 How do I get the auth.messages.logged_in in response.flash only at login?

 I try many different things without success.

 Is auth.messages.logged_in as to be put in auth form controller?

 On Wed, Nov 24, 2010 at 11:18 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  how about something like this?

  auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
  '+appTitle')

  def index():
     
     Index page
     
     session.counter = (session.counter or 0) + 1
     if auth.user and auth.user.first_name!=0 and session.counter=0:
          pass
      elif session.counter0:
         pass
     else:
          if not response.flash: response.flash = T('Hello')
     return dict(message=T(''))

  On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
  wrote:
   Hello

   I need to have a response.flash on index page at login but not when the
  user
   come back on index page during a session. I try to user session.counter
  but
   the session is not reset until the cookies are erase I think.

   Here my index controller (*not working*) :

   def index():
       
       Index page
       
       session.counter = (session.counter or 0) + 1
       if auth.user and auth.user.first_name!=0 and session.counter=0:
           response.flash = DIV(T('Hello ')+str(auth.user and
   auth.user.first_name),BR(),T('Welcome on the '),appTitle)
       elif session.counter0:
           pass
       else:
           response.flash = T('Hello')
       return dict(message=T(''))

   Richard




[web2py] Re: web2py SSL + Apache + mod_wsgi issues on Ubuntu 8.08 VM machine

2010-11-24 Thread Hybride
 You seem to have two different problems. I tried to access 
 addresshttp://147.126.65.92/adminand got the You don't have permission to
 access /admin/default/index on this server. error message, this sounds
 like the admin application is not installed or your webserver is not
 allowed to read the /applications/admin folder. Look at your file
 permissions on /applications folder.

 If webserver could access the applications/admin folder you should get a
 Admin is disabled because insecure channel messages.

I received that error when I tried to disable SSL admin access, but
not otherwise. I have 755 permissions on the /applications folder.

 As admin should be accessed via https I tried to 
 accesshttps://147.126.65.92/adminbut could not get a response from your
 server. Smells like a firewall issue. Port 443 should be open.

I've opened up Port 443, and now I get this issue logging into the
https:/admin:

Internal error
Ticket issued: admin/
76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

For some reason, it's just the admin folder now. I tried accessing the
site using https:// and it works normally, it's only the
administration folders I have an issue with now.


Re: [web2py] Re: detect user login

2010-11-24 Thread Richard Vézina
You meen that this, any where in controllers

auth.messages.logged_in=DIV(T('Hello '),
str(auth.user and auth.user.first_name),
BR(),
T('Welcome on the '),
appTitle,
session.counter)

Should prompt in response.flash once at login?

Not working for me...

Richard



On Wed, Nov 24, 2010 at 12:06 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 Well be used to set the flash immediately after login. You can put it
 anywere you want (models or same controller as user action) and should
 work.

 On Nov 24, 10:56 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  How do I get the auth.messages.logged_in in response.flash only at login?
 
  I try many different things without success.
 
  Is auth.messages.logged_in as to be put in auth form controller?
 
  On Wed, Nov 24, 2010 at 11:18 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   how about something like this?
 
   auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
   '+appTitle')
 
   def index():
  
  Index page
  
  session.counter = (session.counter or 0) + 1
  if auth.user and auth.user.first_name!=0 and session.counter=0:
   pass
   elif session.counter0:
  pass
  else:
   if not response.flash: response.flash = T('Hello')
  return dict(message=T(''))
 
   On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
Hello
 
I need to have a response.flash on index page at login but not when
 the
   user
come back on index page during a session. I try to user
 session.counter
   but
the session is not reset until the cookies are erase I think.
 
Here my index controller (*not working*) :
 
def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and session.counter=0:
response.flash = DIV(T('Hello ')+str(auth.user and
auth.user.first_name),BR(),T('Welcome on the '),appTitle)
elif session.counter0:
pass
else:
response.flash = T('Hello')
return dict(message=T(''))
 
Richard
 
 



[web2py] Re: web2py SSL + Apache + mod_wsgi issues on Ubuntu 8.08 VM machine

2010-11-24 Thread mdipierro
Open this file with an editor

/home/www-data/web2py/applications/admin/errors/
76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

The traceback is the end of the file.

On Nov 24, 11:06 am, Hybride mshybr...@gmail.com wrote:
  You seem to have two different problems. I tried to access 
  addresshttp://147.126.65.92/adminandgot the You don't have permission to
  access /admin/default/index on this server. error message, this sounds
  like the admin application is not installed or your webserver is not
  allowed to read the /applications/admin folder. Look at your file
  permissions on /applications folder.

  If webserver could access the applications/admin folder you should get a
  Admin is disabled because insecure channel messages.

 I received that error when I tried to disable SSL admin access, but
 not otherwise. I have 755 permissions on the /applications folder.

  As admin should be accessed via https I tried to 
  accesshttps://147.126.65.92/adminbutcould not get a response from your
  server. Smells like a firewall issue. Port 443 should be open.

 I've opened up Port 443, and now I get this issue logging into the
 https:/admin:

 Internal error
 Ticket issued: admin/
 76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

 For some reason, it's just the admin folder now. I tried accessing the
 site using https:// and it works normally, it's only the
 administration folders I have an issue with now.


Re: [web2py] Re: detect user login

2010-11-24 Thread Richard Vézina
Ok I found why I was redirecting to an other controller from default/index
function...

How can I replace default controller by my own default controller? Is it
something possible?

Richard



On Wed, Nov 24, 2010 at 12:09 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 You meen that this, any where in controllers

 auth.messages.logged_in=DIV(T('Hello '),
 str(auth.user and auth.user.first_name),
 BR(),
 T('Welcome on the '),
 appTitle,
 session.counter)

 Should prompt in response.flash once at login?

 Not working for me...

 Richard



 On Wed, Nov 24, 2010 at 12:06 PM, mdipierro mdipie...@cs.depaul.eduwrote:

 Well be used to set the flash immediately after login. You can put it
 anywere you want (models or same controller as user action) and should
 work.

 On Nov 24, 10:56 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  How do I get the auth.messages.logged_in in response.flash only at
 login?
 
  I try many different things without success.
 
  Is auth.messages.logged_in as to be put in auth form controller?
 
  On Wed, Nov 24, 2010 at 11:18 AM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   how about something like this?
 
   auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
   '+appTitle')
 
   def index():
  
  Index page
  
  session.counter = (session.counter or 0) + 1
  if auth.user and auth.user.first_name!=0 and session.counter=0:
   pass
   elif session.counter0:
  pass
  else:
   if not response.flash: response.flash = T('Hello')
  return dict(message=T(''))
 
   On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
Hello
 
I need to have a response.flash on index page at login but not when
 the
   user
come back on index page during a session. I try to user
 session.counter
   but
the session is not reset until the cookies are erase I think.
 
Here my index controller (*not working*) :
 
def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and session.counter=0:
response.flash = DIV(T('Hello ')+str(auth.user and
auth.user.first_name),BR(),T('Welcome on the '),appTitle)
elif session.counter0:
pass
else:
response.flash = T('Hello')
return dict(message=T(''))
 
Richard
 
 





[web2py] Re: detect user login

2010-11-24 Thread mdipierro
What does not working mean for you?

That is not the code I asked you to try. This does not help isolate
the issue since you have everything in this message (helpers, T,
strings, session, auth variables). Try with a simple string first.


On Nov 24, 11:09 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 You meen that this, any where in controllers

 auth.messages.logged_in=DIV(T('Hello '),
             str(auth.user and auth.user.first_name),
             BR(),
             T('Welcome on the '),
             appTitle,
             session.counter)

 Should prompt in response.flash once at login?

 Not working for me...

 Richard

 On Wed, Nov 24, 2010 at 12:06 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  Well be used to set the flash immediately after login. You can put it
  anywere you want (models or same controller as user action) and should
  work.

  On Nov 24, 10:56 am, Richard Vézina ml.richard.vez...@gmail.com
  wrote:
   How do I get the auth.messages.logged_in in response.flash only at login?

   I try many different things without success.

   Is auth.messages.logged_in as to be put in auth form controller?

   On Wed, Nov 24, 2010 at 11:18 AM, mdipierro mdipie...@cs.depaul.edu
  wrote:
how about something like this?

auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
'+appTitle')

def index():
   
   Index page
   
   session.counter = (session.counter or 0) + 1
   if auth.user and auth.user.first_name!=0 and session.counter=0:
        pass
    elif session.counter0:
       pass
   else:
        if not response.flash: response.flash = T('Hello')
   return dict(message=T(''))

On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 Hello

 I need to have a response.flash on index page at login but not when
  the
user
 come back on index page during a session. I try to user
  session.counter
but
 the session is not reset until the cookies are erase I think.

 Here my index controller (*not working*) :

 def index():
     
     Index page
     
     session.counter = (session.counter or 0) + 1
     if auth.user and auth.user.first_name!=0 and session.counter=0:
         response.flash = DIV(T('Hello ')+str(auth.user and
 auth.user.first_name),BR(),T('Welcome on the '),appTitle)
     elif session.counter0:
         pass
     else:
         response.flash = T('Hello')
     return dict(message=T(''))

 Richard




[web2py] formatting in IS_IN_DB() list

2010-11-24 Thread Mirek Zvolský
start is datetime,
I need: start.strftime(%d.%m.%Y)

How can I do it (format the datetime) in the requires=...:
requires=IS_IN_DB(db, 'lesson.id', '%(start)s')


I'm sorry, maybe this is more python question as web2py question?
Thanks in advance.
Mirek


[web2py] targeted web2py_ajax_init for dynamically inserted forms

2010-11-24 Thread Josh Jaques
If you load a form onto a web2py page via AJAX, it doesn't get the enhancements 
from web2py_ajax_init().

I've included a modified web2py_ajax_init that accepts an optional parent 
selector to provide some scope to web2py_ajax_init. In this way if you load a 
form onto a page, you can call web2py_ajax_init on that specific form to give 
it the enhancements, without effecting every other form on the page.

I've included the modified function here as it may be useful to others in the 
future.

An alternative approach may be to bind events using jQuery.live(), so that you 
don't have to explicitly call web2py_ajax_init() every time you load a form.


function web2py_ajax_init(parent) {
  var find = function(selector) {
  if (parent)
  return $(parent).find(selector);
  else
  return jQuery(selector);
  }
  find('.hidden').hide();
  find('.error').hide().slideDown('slow');
  find('.flash').click(function() { find(this).fadeOut('slow'); return false; 
});
  // find('input[type=submit]').click(function(){var 
t=find(this);t.hide();t.after('input class=submit_disabled 
disabled=disabled type=submit name='+t.attr(name)+'_dummy 
value='+t.val()+'')});
  
find('input.integer').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
  
find('input.double,input.decimal').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,'').reverse();});
  
find(input[type='checkbox'].delete).each(function(){find(this).click(function()
 { if(this.checked) if(!confirm({{=T('Sure you want to delete this 
object?')}})) this.checked=false; });});
  try {find(input.date).focus(function() {Calendar.setup({
 inputField:this.id, ifFormat:{{=T('%Y-%m-%d')}}, showsTime:false
  }); }); } catch(e) {};
  try { find(input.datetime).focus( function() {Calendar.setup({
 inputField:this.id, ifFormat:{{=T('%Y-%m-%d %H:%M:%S')}}, showsTime: 
true,timeFormat: 24
  }); }); } catch(e) {};
  try { find(input.time).timeEntry(); } catch(e) {};
};
---

This communication, including any attachments, does not necessarily represent 
official policy of Seccuris Inc.
Please see http://www.seccuris.com/Contact-PrivacyPolicy.htm  for further 
details about Seccuris Inc.'s Privacy Policy.
If you have received this communication in error, please notify Seccuris Inc. 
at i...@seccuris.com or at 1-866-644-8442.



[web2py] Re: formatting in IS_IN_DB() list

2010-11-24 Thread annet
Have a look at this post:

http://groups.google.com/group/web2py/browse_thread/thread/a7e9e4dc8bcde913/d7ec8b0e35f0aee0


Kind regards,

Annet.


Re: [web2py] Re: web2py SSL + Apache + mod_wsgi issues on Ubuntu 8.08 VM machine

2010-11-24 Thread Kenneth Lundström
Are the group and ownership of the files in /applicatios/admin correct. 
Could you send a copy of the error file as I can´t access it from 
outside without a password and not when admin is no working.



Kenneth


Open this file with an editor

/home/www-data/web2py/applications/admin/errors/
76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

The traceback is the end of the file.

On Nov 24, 11:06 am, Hybridemshybr...@gmail.com  wrote:

You seem to have two different problems. I tried to access 
addresshttp://147.126.65.92/adminandgot the You don't have permission to
access /admin/default/index on this server. error message, this sounds
like the admin application is not installed or your webserver is not
allowed to read the /applications/admin folder. Look at your file
permissions on /applications folder.
If webserver could access the applications/admin folder you should get a
Admin is disabled because insecure channel messages.

I received that error when I tried to disable SSL admin access, but
not otherwise. I have 755 permissions on the /applications folder.


As admin should be accessed via https I tried to 
accesshttps://147.126.65.92/adminbutcould not get a response from your
server. Smells like a firewall issue. Port 443 should be open.

I've opened up Port 443, and now I get this issue logging into the
https:/admin:

Internal error
Ticket issued: admin/
76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

For some reason, it's just the admin folder now. I tried accessing the
site using https:// and it works normally, it's only the
administration folders I have an issue with now.




[web2py] send attachment via xmlrpclib

2010-11-24 Thread António Ramos
Hello,
Is it possible to send an attachment from a python program to an web2py  app
 via xmlrpclib?

I have a working app with xmlrpc exposed

i have a python program that has this code


import xmlrpclib
server = xmlrpclib.ServerProxy('
http://127.0.0.1:8000/BlaBlaBla/default/call/xmlrpc')

what do i have to add  to send a pdf file for example to BlaBlaBla app ?



Best regards


António


[web2py] Actions exposed by auth.

2010-11-24 Thread appydev
Greetings

I have another question from beginner:

In web2py book reads as follows:

By default they are all exposed, but it is possible to restrict access to
only some of these actions.

Referring to the following:

http://.../ [app] / default / user / register
http://.../ [app] / default / user / login
http://.../ [app] / default / user / logout
http://.../ [app] / default / user / profile
http://.../ [app] / default / user / change_password
http://.../ [app] / default / user / verify_email
http://.../ [app] / default / user / retrieve_username
http://.../ [app] / default / user / request_reset_password
http://.../ [app] / default / user / reset_password
http://.../ [app] / default / user / impersonate
http://.../ [app] / default / user / groups
http://.../ [app] / default / user / not_authorized


Is it possible to expose only some of these actions?


[web2py] Re: How could I send a email to every members?

2010-11-24 Thread annet
Here are the layouts I am using:

maillayout.html


html
  head
meta http-equiv=Content-Type content=text/html;
charset=utf-8 /
title {{if response.title:}}{{=response.title}}{{else:}}
{{=URL(r=request)}}{{pass}} /title
  /head
  body
style type=text/css media=screen
  {{include 'css.html'}}
/style
{{domain='http://www.fitwise.nl'}}
table class=bg1 width=100% border=0 cellspacing=0
cellpadding=0
  tbody
tr
  td align=center
table class=bg2 width=600 border=0 cellspacing=0
cellpadding=0
  tbody
tr
  td class=browserversion align=left
pHaving trouble viewing this email? {{=A('View
it in your browser', _href=domain +
URL(r=request,f='browser_version',args=[item.company_id]),
_target=_blank)}}/p
  /td
/tr
tr
  td class=header align=left
img src=http://www.images.fitwise.nl/
crm_header.jpg alt=Header width=600 height=192 /
  /td
/tr
tr
  td valign=top class=body
table width=100% border=0 cellspacing=0
cellpadding=0
  tbody
tr
  td class=content valign=top
align=left
h2Fitwise/h2
{{include}}
p class=signaturebr /Kind
regards,br /
br /Team Fitwise
/p
  /td
/tr
  /tbody
/table
  /td
/tr
tr
  td class=footer valign=middle align=left
height=61
pNot interested anymore? {{=A('Unsubscribe',
_href=domain +
URL(r=request,c='default',f='unsubscribe',args=[item.company_id,'logomail']),
_target=_blank)}}/p
  /td
/tr
  /tbody
/table
  /td
/tr
  /tbody
/table
  /body
/html




mail.html

{{extend 'maillayout.html'}}

pText .../p
pText ... /p
etc.




css.html

body {
  background-color: #EE;
}
table.bg1 {
  background-color: #EE;
}
table.bg2 {
  background-color: #FF;
}
td.browserversion {
  background-color: #EE;
  padding: 9px 24px 9px 24px;
}
td.browserversion p {
  color: #44;
  font-family: Arial;
  font-size: 11px;
  font-weight: normal;
  margin: 0;
  padding: 0;
}
td.browserversion p a {
  color: #44;
  font-family: Arial;
  font-size: 11px;
  font-weight: normal;
  text-decoration: underline;
}
td.body {
  background-color: #FF;
  padding: 24px 24px 24px 24px;
}
td.content {
  margin: 0;
  padding: 0px 24px 0px 24px;
}
td.content h2 {
  color: #4169E1;
  font-family: Arial;
  font-size: 16px;
  font-weight: bold;
  margin: 0;
  padding: 0;
}
td.content p, .data td {
  color: #44;
  font-family: Arial;
  font-size: 13px;
  font-weight: normal;
  margin: 12px 0 12px 0;
  padding: 0;
}
td.content p a, .data td a {
  color: #4169E1;
  font-family: Arial;
  font-size: 13px;
  font-weight: normal;
  text-decoration: none;
}
td.content ul li {
  color: #44;
  font-family: Arial;
  font-size: 13px;
  font-weight: normal;
}
td.content p.signature {
  font-family: Arial;
  font-size: 13px;
  font-weight: normal;
  text-align: right;
  padding: 0 24px 0 0;
}
td.footer {
  background-color: #AA;
  text-align: center;
  height: 36px;
  vertical-align: middle;
}
td.footer p {
  color: #FF;
  font-family: Arial;
  font-size: 11px;
  font-weight: normal;
  margin: 0;
  padding: 0;
}
td.footer p a {
  color: #FF;
  font-family: Arial;
  font-size: 11px;
  font-weight: normal;
  text-decoration: underline;
}




You need: {{domain='http://www.fitwise.nl'}} because the recipient of
the email doesn't know the hostname. See this post for comments on
this solution: 
http://groups.google.com/group/web2py/browse_thread/thread/917e56e86ee973d/6ad92427381358ac

Since, for the time being, this works for me I so far didn't bother to
implement a better solution.


The browser version of the mail is similar to this one except that
it's adjusted to display in a browser.


Kind regards,

Annet.







[web2py] remember widget

2010-11-24 Thread mattynoce
hi all. i'm making a custom login form and, as per this thread, can't
get the remember widget to show up:
http://groups.google.com/group/web2py/browse_thread/thread/8519e2e48891f03e/258643e0875d0027?hl=enlnk=gstq=custom+widget+remember#258643e0875d0027

it's not {{=form.custom.widget.remember}}. does anyone know how to get
that working?

thanks,

matt


[web2py] Re: How could I send a email to every members?

2010-11-24 Thread annet
Hi Thadeus,

Back in April when I was working on sending an email from within
web2py I had a look at this slice:

http://www.web2pyslices.com/main/slices/take_slice/69


At the time this was too complicated for me to implement, so I chose
the procedure described above. Besides, the sentence 'the code could
be improved' also made me decide to lay this aside.

Your suggestion is on my to-do list, but, since I don't send more than
750 mails a time, which takes less than a minute, it doesn't have
priority.


Kind regards,

Annet


[web2py] Re: send attachment via xmlrpclib

2010-11-24 Thread mdipierro
I have had similar problem before. xmlrpclib cannot stream data so I
cannot handle large content such as a file attachment.

On Nov 24, 12:28 pm, António Ramos ramstei...@gmail.com wrote:
 Hello,
 Is it possible to send an attachment from a python program to an web2py  app
  via xmlrpclib?

 I have a working app with xmlrpc exposed

 i have a python program that has this code

 import xmlrpclib
 server = 
 xmlrpclib.ServerProxy('http://127.0.0.1:8000/BlaBlaBla/default/call/xmlrpc')

 what do i have to add  to send a pdf file for example to BlaBlaBla app ?

 Best regards

 António


[web2py] Re: Actions exposed by auth.

2010-11-24 Thread mdipierro
auth.settings.actions_disabled=['groups','impersonate'] # etc etc

On Nov 24, 12:34 pm, appydev appy...@gmail.com wrote:
 Greetings

 I have another question from beginner:

 In web2py book reads as follows:

 By default they are all exposed, but it is possible to restrict access to
 only some of these actions.

 Referring to the following:

 http://.../[app] / default / user / registerhttp://.../[app] / default / user 
 / loginhttp://.../[app] / default / user / logouthttp://.../[app] / default / 
 user / profilehttp://.../[app] / default / user / 
 change_passwordhttp://.../[app] / default / user / 
 verify_emailhttp://.../[app] / default / user / 
 retrieve_usernamehttp://.../[app] / default / user / 
 request_reset_passwordhttp://.../[app] / default / user / 
 reset_passwordhttp://.../[app] / default / user / impersonatehttp://.../[app] 
 / default / user / groupshttp://.../[app] / default / user / not_authorized

 Is it possible to expose only some of these actions?


[web2py] Re: remember widget

2010-11-24 Thread mdipierro
I do not think the remember widget exists. The HTML is injected in the
form. There is no widget because it does not go in the database model.

On Nov 24, 12:43 pm, mattynoce mattyn...@gmail.com wrote:
 hi all. i'm making a custom login form and, as per this thread, can't
 get the remember widget to show 
 up:http://groups.google.com/group/web2py/browse_thread/thread/8519e2e488...

 it's not {{=form.custom.widget.remember}}. does anyone know how to get
 that working?

 thanks,

 matt


[web2py] Re: web2py SSL + Apache + mod_wsgi issues on Ubuntu 8.08 VM machine

2010-11-24 Thread Hybride
S'Traceback (most recent call last):\n  File gluon/main.py, line
453, in wsgibase\nsession._try_store_on_disk(request, response)\n
File gluon/globals.py, line 381, in _try_store_on_disk\n
response.session_file = open(response.session_filename, \'wb\')
\nIOError: [Errno 13] Permission denied: \'/home/www-data/web2py/
applications/admin/sessions/76-192-187-2-63112711-350d-4c4e-
bdf3-9e5127a27992\'\n'
p201
s.

Is what was in the end of the file.

On Nov 24, 11:17 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Open this file with an editor

 /home/www-data/web2py/applications/admin/errors/
 76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

 The traceback is the end of the file.

 On Nov 24, 11:06 am, Hybride mshybr...@gmail.com wrote:



   You seem to have two different problems. I tried to access 
   addresshttp://147.126.65.92/adminandgotthe You don't have permission to
   access /admin/default/index on this server. error message, this sounds
   like the admin application is not installed or your webserver is not
   allowed to read the /applications/admin folder. Look at your file
   permissions on /applications folder.

   If webserver could access the applications/admin folder you should get a
   Admin is disabled because insecure channel messages.

  I received that error when I tried to disable SSL admin access, but
  not otherwise. I have 755 permissions on the /applications folder.

   As admin should be accessed via https I tried to 
   accesshttps://147.126.65.92/adminbutcouldnot get a response from your
   server. Smells like a firewall issue. Port 443 should be open.

  I've opened up Port 443, and now I get this issue logging into the
  https:/admin:

  Internal error
  Ticket issued: admin/
  76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

  For some reason, it's just the admin folder now. I tried accessing the
  site using https:// and it works normally, it's only the
  administration folders I have an issue with now.


[web2py] Re: web2py SSL + Apache + mod_wsgi issues on Ubuntu 8.08 VM machine

2010-11-24 Thread mdipierro
You do not have write permissions in the application admin/sessions
folder.

Massimo

On Nov 24, 12:54 pm, Hybride mshybr...@gmail.com wrote:
 S'Traceback (most recent call last):\n  File gluon/main.py, line
 453, in wsgibase\n    session._try_store_on_disk(request, response)\n
 File gluon/globals.py, line 381, in _try_store_on_disk\n
 response.session_file = open(response.session_filename, \'wb\')
 \nIOError: [Errno 13] Permission denied: \'/home/www-data/web2py/
 applications/admin/sessions/76-192-187-2-63112711-350d-4c4e-
 bdf3-9e5127a27992\'\n'
 p201
 s.

 Is what was in the end of the file.

 On Nov 24, 11:17 am, mdipierro mdipie...@cs.depaul.edu wrote:

  Open this file with an editor

  /home/www-data/web2py/applications/admin/errors/
  76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

  The traceback is the end of the file.

  On Nov 24, 11:06 am, Hybride mshybr...@gmail.com wrote:

You seem to have two different problems. I tried to access 
addresshttp://147.126.65.92/adminandgottheYou don't have permission to
access /admin/default/index on this server. error message, this sounds
like the admin application is not installed or your webserver is not
allowed to read the /applications/admin folder. Look at your file
permissions on /applications folder.

If webserver could access the applications/admin folder you should get a
Admin is disabled because insecure channel messages.

   I received that error when I tried to disable SSL admin access, but
   not otherwise. I have 755 permissions on the /applications folder.

As admin should be accessed via https I tried to 
accesshttps://147.126.65.92/adminbutcouldnotget a response from your
server. Smells like a firewall issue. Port 443 should be open.

   I've opened up Port 443, and now I get this issue logging into the
   https:/admin:

   Internal error
   Ticket issued: admin/
   76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

   For some reason, it's just the admin folder now. I tried accessing the
   site using https:// and it works normally, it's only the
   administration folders I have an issue with now.




[web2py] Re: remember widget

2010-11-24 Thread mattynoce
simple enough. to save time for those who look here, the html is:
div
input class=checkbox id=auth_user_remember name=remember
type=checkbox value=on /
label for=auth_user_remember
Remember me (for 30 days)
/label
/div


On Nov 24, 10:49 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not think the remember widget exists. The HTML is injected in the
 form. There is no widget because it does not go in the database model.

 On Nov 24, 12:43 pm, mattynoce mattyn...@gmail.com wrote:

  hi all. i'm making a custom login form and, as per this thread, can't
  get the remember widget to show 
  up:http://groups.google.com/group/web2py/browse_thread/thread/8519e2e488...

  it's not {{=form.custom.widget.remember}}. does anyone know how to get
  that working?

  thanks,

  matt




[web2py] libcloud

2010-11-24 Thread mdipierro
http://incubator.apache.org/libcloud/

I can see some nice web2py appliances built on top of this...


[web2py] Re: web2py SSL + Apache + mod_wsgi issues on Ubuntu 8.08 VM machine

2010-11-24 Thread Hybride
Holy hell, that worked.

Thank you so much for all of your guys help.

On Nov 24, 12:55 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You do not have write permissions in the application admin/sessions
 folder.

 Massimo

 On Nov 24, 12:54 pm, Hybride mshybr...@gmail.com wrote:



  S'Traceback (most recent call last):\n  File gluon/main.py, line
  453, in wsgibase\n    session._try_store_on_disk(request, response)\n
  File gluon/globals.py, line 381, in _try_store_on_disk\n
  response.session_file = open(response.session_filename, \'wb\')
  \nIOError: [Errno 13] Permission denied: \'/home/www-data/web2py/
  applications/admin/sessions/76-192-187-2-63112711-350d-4c4e-
  bdf3-9e5127a27992\'\n'
  p201
  s.

  Is what was in the end of the file.

  On Nov 24, 11:17 am, mdipierro mdipie...@cs.depaul.edu wrote:

   Open this file with an editor

   /home/www-data/web2py/applications/admin/errors/
   76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

   The traceback is the end of the file.

   On Nov 24, 11:06 am, Hybride mshybr...@gmail.com wrote:

 You seem to have two different problems. I tried to access 
 addresshttp://147.126.65.92/adminandgottheYou don't have permission 
 to
 access /admin/default/index on this server. error message, this 
 sounds
 like the admin application is not installed or your webserver is not
 allowed to read the /applications/admin folder. Look at your file
 permissions on /applications folder.

 If webserver could access the applications/admin folder you should 
 get a
 Admin is disabled because insecure channel messages.

I received that error when I tried to disable SSL admin access, but
not otherwise. I have 755 permissions on the /applications folder.

 As admin should be accessed via https I tried to 
 accesshttps://147.126.65.92/adminbutcouldnotgeta response from your
 server. Smells like a firewall issue. Port 443 should be open.

I've opened up Port 443, and now I get this issue logging into the
https:/admin:

Internal error
Ticket issued: admin/
76.192.187.2.2010-11-24.10-52-27.f3c370f6-8a25-4dc6-b496-ae1178050333

For some reason, it's just the admin folder now. I tried accessing the
site using https:// and it works normally, it's only the
administration folders I have an issue with now.


Re: [web2py] Re: detect user login

2010-11-24 Thread Richard Vézina
I get :
Hello %(first_name)s

in flash response with this in default.py :

auth.messages.logged_in=T('Hello %(first_name)s')#+str(auth.user and
auth.user.first_name))

@auth.requires_login()
def index():

Index page using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html

#auth.messages.logged_in=DIV(T('Hello '),
#str(auth.user and auth.user.first_name),
#BR(),
#T('Welcome on the '),
#appTitle)
if auth.user and auth.user.first_name!=0:
response.flash
if not response.flash: response.flash = T('Hello')
return dict(message=T(''))

Richard

On Wed, Nov 24, 2010 at 12:19 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 What does not working mean for you?

 That is not the code I asked you to try. This does not help isolate
 the issue since you have everything in this message (helpers, T,
 strings, session, auth variables). Try with a simple string first.


 On Nov 24, 11:09 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  You meen that this, any where in controllers
 
  auth.messages.logged_in=DIV(T('Hello '),
  str(auth.user and auth.user.first_name),
  BR(),
  T('Welcome on the '),
  appTitle,
  session.counter)
 
  Should prompt in response.flash once at login?
 
  Not working for me...
 
  Richard
 
  On Wed, Nov 24, 2010 at 12:06 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   Well be used to set the flash immediately after login. You can put it
   anywere you want (models or same controller as user action) and should
   work.
 
   On Nov 24, 10:56 am, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
How do I get the auth.messages.logged_in in response.flash only at
 login?
 
I try many different things without success.
 
Is auth.messages.logged_in as to be put in auth form controller?
 
On Wed, Nov 24, 2010 at 11:18 AM, mdipierro mdipie...@cs.depaul.edu
 
   wrote:
 how about something like this?
 
 auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
 '+appTitle')
 
 def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and session.counter=0:
 pass
 elif session.counter0:
pass
else:
 if not response.flash: response.flash = T('Hello')
return dict(message=T(''))
 
 On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  Hello
 
  I need to have a response.flash on index page at login but not
 when
   the
 user
  come back on index page during a session. I try to user
   session.counter
 but
  the session is not reset until the cookies are erase I think.
 
  Here my index controller (*not working*) :
 
  def index():
  
  Index page
  
  session.counter = (session.counter or 0) + 1
  if auth.user and auth.user.first_name!=0 and
 session.counter=0:
  response.flash = DIV(T('Hello ')+str(auth.user and
  auth.user.first_name),BR(),T('Welcome on the '),appTitle)
  elif session.counter0:
  pass
  else:
  response.flash = T('Hello')
  return dict(message=T(''))
 
  Richard
 
 



[web2py] Re: working script to install virtualenv and then install and start web2py

2010-11-24 Thread Christopher Steel
I posted some background info on using virtualenv here:

http://web2pyslices.com/main/slices/take_slice/105


On Nov 24, 3:49 am, Chris Steel chris.st...@gmail.com wrote:
 scripts/setup-virtualenv-web2py.sh in the trunk does not seem to be working.
 Here is a replacement that should do the trick on most posix systems.

 it downloads virtualenv, installs it, creates a virtual environment
 directory and starts the virtual environment in the new directory. Then it
 installs the latest version of web2py to the virtual environment and starts
 web2py.

 Once you complete your web2py session you will want to shut down the virtual
 environment by typing 'disactivate' in the terminal, see notes in the script
 for details

 Seems to work fine on OSX but I have not been running it for very long ;).
 Please test.

 It could create a directory to hold all the virtual environments, I was
 thinking that something like ${HOME}/dev/environments might work, feedback
 welcome.

 Massimo, please feel free to include in in the trunk as is if you wish or I
 could update it to create a directory in the users home directory
 automatically

 Cheers,

 Chris

 --
 Christopher Steel

 Voice of Access

  setup-virtualenv-install-web2py.sh
 3KViewDownload


Re: [web2py] Re: Get User [auth_user] Janrain

2010-11-24 Thread Andrew Evans
Hello I solved my error by adding auth.define_tables() to the mix

Janrain loads as expected except when I try to login. Any idea how to solve
this issue, I get the following error

Invalid argument: token_url domain not in whitelist


[web2py] login in text-mode ipython

2010-11-24 Thread Richard Vézina
Hello,

Can I login in with app user in text-mode??

I start web2py like this :

python web2py.py -a 'password' -S 'myapp' -M -p 9000

Then in ipython can I log in with one of my user?

Richard


[web2py] exercise: automatic conversion of a static site into a web2py site

2010-11-24 Thread mdipierro
I have a challanage:

write a script that takes a folder that contains a static html file
and converts it into an HTML site.

1) moves all non .html files into static/
2) moves all .html files into views/xxx/
3) creates a controllers/xxx.py and for each yyy.html file add an
action

def yyy(): return dict()

4) loop over all .html files and fixes all the URL to {{=URL(...)}}}

OPTIONAL:
5)
If all .html files start with a similar header and footer, tried to
identify them, moves header{{include}}footer into views/
layout.html and rewrite the html files to {{extend 'layout.html'}}

The original folder and 'xxx' should be uer defined. This could be
added to the wizard.

Massimo


[web2py] redirect using a new window

2010-11-24 Thread leone
Hi,
there is a way to redirect to a new page simulating A ,
target='new' using URL()
or a controller function???
Thanks
leone


[web2py] token_url domain not in whitelist

2010-11-24 Thread Andrew Evans
Figured I would start a different post for this :-)

Don't know if there is a problem in my Janrain account or if it exists in
web2py

but I get the following error

token_url domain not in whitelist

my domains are set in janrain to www.em-ecommerce.com and www.suck-o.de

and my code is like this

from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(request,
api_key='...',
domain='em',
url = http://www.em-ecommmerce.com/%s/default/user/login; %
request.application)

any ideas as to the error

*cheers


[web2py] Re: send attachment via xmlrpclib

2010-11-24 Thread mart
yeah, this is one area where xtra time to tinker around would be
great... Here's what I do and where web2py has made my life easier
(using this part with the DAL as stand alone, but same would apply
with an online instance as well).

I re-purposed an app I put together a few years back where one of the
key elements I wanted today was the distributed queuing for
accomplishing distributed tasks. This back end stuff (with the full
web2py as the front end) needs to share large chunks of data, and
since xmlrpc can't't do job 1/2 the time, my first idea (form a few
years back) was to split the data in a way to make all the pieces
stand on its own (like instead having the full recipe for cheese cake,
I compartmentalized the instructions I.e. 1. gather ingredients [you
will need items from this list], 2. make the dry mix [here is the list
of dry ingredients, ask whoever was asked to gather them to send them
to you], 3. make the wet mix [same as item 2] 4. grease the pan [you
will need these items], etc... then all would send back results.
Worked well enough. Now, I do a little bit of the same thing, but more
efficiently. Now when the automation sees that it needs to distribute
a task, it simply sends high level instructions by broadcasting a
todo list. available servers (all sitting on a web2py framework),
take on the items on the list, they already know where to go for the
details on the task: All the required data to fulfill the task (even
if user controlled) sits in a central SQLite DB which lives along side
an xmlrpc socket server where all servers can access using the web2py
dal.  With that I can use a web2py app to query result, status or
launch another task manually or setup up a task to be available
through automation.

So, the moral: where I can't send a server some data, I tell it where
to get it. So, that said, If I were to need to send PDFs, i would send
them as chunks and reassemble at the other end (provided that server
has the means to reassemble). an example close to this: when the
system was tasked with sending large filesets across sites (like tar
balls), it would send local servers the instruction to extract the
large tar ball (if the size reached a given threshold), then provide
the contributing servers with a list of which bits of the tar ball
they would push to the receiving file server. Then re-tar the contents
at the other end...

But, I remember a posting (last week maybe?) where someone was
mentioning some sort of lib where this may be usefull (I remember
thinking sounds a little like execnet)... Perhaps Massimo can recall
the post? - when suggesting that web2py make use of the lib, you said
you were already looking at it...

Anyways, hope it helps

Mart :)

On Nov 24, 1:46 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I have had similar problem before. xmlrpclib cannot stream data so I
 cannot handle large content such as a file attachment.

 On Nov 24, 12:28 pm, António Ramos ramstei...@gmail.com wrote:

  Hello,
  Is it possible to send an attachment from a python program to an web2py  app
   via xmlrpclib?

  I have a working app with xmlrpc exposed

  i have a python program that has this code

  import xmlrpclib
  server = 
  xmlrpclib.ServerProxy('http://127.0.0.1:8000/BlaBlaBla/default/call/xmlrpc')

  what do i have to add  to send a pdf file for example to BlaBlaBla app ?

  Best regards

  António




[web2py] Re: exercise: automatic conversion of a static site into a web2py site

2010-11-24 Thread mart
can you provide a sample folder + contents?

Mart :)

On Nov 24, 3:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I have a challanage:

 write a script that takes a folder that contains a static html file
 and converts it into an HTML site.

 1) moves all non .html files into static/
 2) moves all .html files into views/xxx/
 3) creates a controllers/xxx.py and for each yyy.html file add an
 action

 def yyy(): return dict()

 4) loop over all .html files and fixes all the URL to {{=URL(...)}}}

 OPTIONAL:
 5)
 If all .html files start with a similar header and footer, tried to
 identify them, moves header{{include}}footer into views/
 layout.html and rewrite the html files to {{extend 'layout.html'}}

 The original folder and 'xxx' should be uer defined. This could be
 added to the wizard.

 Massimo


Re: [web2py] libcloud

2010-11-24 Thread Michele Comitini
This is COOL stuff!

finally apache is taking in consideration python:
without backing from Sun with the java marketing, they are more open
to real solutions ;-)

2010/11/24 mdipierro mdipie...@cs.depaul.edu:
 http://incubator.apache.org/libcloud/

 I can see some nice web2py appliances built on top of this...


[web2py] Re: How could I send a email to every members?

2010-11-24 Thread mart
thanks for that :)

On Nov 24, 1:36 pm, annet annet.verm...@gmail.com wrote:
 Here are the layouts I am using:

 maillayout.html

 html
   head
     meta http-equiv=Content-Type content=text/html;
 charset=utf-8 /
     title {{if response.title:}}{{=response.title}}{{else:}}
 {{=URL(r=request)}}{{pass}} /title
   /head
   body
     style type=text/css media=screen
       {{include 'css.html'}}
     /style
     {{domain='http://www.fitwise.nl'}}
     table class=bg1 width=100% border=0 cellspacing=0
 cellpadding=0
       tbody
         tr
           td align=center
             table class=bg2 width=600 border=0 cellspacing=0
 cellpadding=0
               tbody
                 tr
                   td class=browserversion align=left
                     pHaving trouble viewing this email? {{=A('View
 it in your browser', _href=domain +
 URL(r=request,f='browser_version',args=[item.company_id]),
 _target=_blank)}}/p
                   /td
                 /tr
                 tr
                   td class=header align=left
                     img src=http://www.images.fitwise.nl/
 crm_header.jpg alt=Header width=600 height=192 /
                   /td
                 /tr
                 tr
                   td valign=top class=body
                     table width=100% border=0 cellspacing=0
 cellpadding=0
                       tbody
                         tr
                           td class=content valign=top
 align=left
                             h2Fitwise/h2
                             {{include}}
                             p class=signaturebr /Kind
 regards,br /
                             br /Team Fitwise
                             /p
                           /td
                         /tr
                       /tbody
                     /table
                   /td
                 /tr
                 tr
                   td class=footer valign=middle align=left
 height=61
                     pNot interested anymore? {{=A('Unsubscribe',
 _href=domain +
 URL(r=request,c='default',f='unsubscribe',args=[item.company_id,'logomail']),
 _target=_blank)}}/p
                   /td
                 /tr
               /tbody
             /table
           /td
         /tr
       /tbody
     /table
   /body
 /html

 mail.html

 {{extend 'maillayout.html'}}

 pText .../p
 pText ... /p
 etc.

 css.html

 body {
   background-color: #EE;}

 table.bg1 {
   background-color: #EE;}

 table.bg2 {
   background-color: #FF;}

 td.browserversion {
   background-color: #EE;
   padding: 9px 24px 9px 24px;}

 td.browserversion p {
   color: #44;
   font-family: Arial;
   font-size: 11px;
   font-weight: normal;
   margin: 0;
   padding: 0;}

 td.browserversion p a {
   color: #44;
   font-family: Arial;
   font-size: 11px;
   font-weight: normal;
   text-decoration: underline;}

 td.body {
   background-color: #FF;
   padding: 24px 24px 24px 24px;}

 td.content {
   margin: 0;
   padding: 0px 24px 0px 24px;}

 td.content h2 {
   color: #4169E1;
   font-family: Arial;
   font-size: 16px;
   font-weight: bold;
   margin: 0;
   padding: 0;}

 td.content p, .data td {
   color: #44;
   font-family: Arial;
   font-size: 13px;
   font-weight: normal;
   margin: 12px 0 12px 0;
   padding: 0;}

 td.content p a, .data td a {
   color: #4169E1;
   font-family: Arial;
   font-size: 13px;
   font-weight: normal;
   text-decoration: none;}

 td.content ul li {
   color: #44;
   font-family: Arial;
   font-size: 13px;
   font-weight: normal;}

 td.content p.signature {
   font-family: Arial;
   font-size: 13px;
   font-weight: normal;
   text-align: right;
   padding: 0 24px 0 0;}

 td.footer {
   background-color: #AA;
   text-align: center;
   height: 36px;
   vertical-align: middle;}

 td.footer p {
   color: #FF;
   font-family: Arial;
   font-size: 11px;
   font-weight: normal;
   margin: 0;
   padding: 0;}

 td.footer p a {
   color: #FF;
   font-family: Arial;
   font-size: 11px;
   font-weight: normal;
   text-decoration: underline;

 }

 You need: {{domain='http://www.fitwise.nl'}} because the recipient of
 the email doesn't know the hostname. See this post for comments on
 this 
 solution:http://groups.google.com/group/web2py/browse_thread/thread/917e56e86e...

 Since, for the time being, this works for me I so far didn't bother to
 implement a better solution.

 The browser version of the mail is similar to this one except that
 it's adjusted to display in a browser.

 Kind regards,

 Annet.


Re: [web2py] Re: Actions exposed by auth.

2010-11-24 Thread appydev
Thanks again Massimo.

2010/11/24 mdipierro mdipie...@cs.depaul.edu

 auth.settings.actions_disabled=['groups','impersonate'] # etc etc

 On Nov 24, 12:34 pm, appydev appy...@gmail.com wrote:
  Greetings
 
  I have another question from beginner:
 
  In web2py book reads as follows:
 
  By default they are all exposed, but it is possible to restrict access
 to
  only some of these actions.
 
  Referring to the following:
 
  http://.../[app] / default / user / registerhttp://.../[app] / default /
 user / loginhttp://.../[app] / default / user / logouthttp://.../[app] /
 default / user / profilehttp://.../[app] / default / user /
 change_passwordhttp://.../[app] / default / user /
 verify_emailhttp://.../[app] / default / user /
 retrieve_usernamehttp://.../[app] / default / user /
 request_reset_passwordhttp://.../[app] / default / user /
 reset_passwordhttp://.../[app] / default / user /
 impersonatehttp://.../[app] / default / user / groupshttp://.../[app] /
 default / user / not_authorized
 
  Is it possible to expose only some of these actions?



Re: [web2py] redirect using a new window

2010-11-24 Thread Michele Comitini
do you mean like this?

{{=A('click me!', _href=URL(...), _target='new')}}

2010/11/24 leone handja...@gmail.com:
 Hi,
 there is a way to redirect to a new page simulating A ,
 target='new' using URL()
 or a controller function???
 Thanks
 leone


Re: [web2py] Re: exercise: automatic conversion of a static site into a web2py site

2010-11-24 Thread Michele Comitini
Is this a oneshot?
Else I would go scons
(http://www.scons.org/doc/production/HTML/scons-user/index.html)


2010/11/24 mart msenecal...@gmail.com:
 can you provide a sample folder + contents?

 Mart :)

 On Nov 24, 3:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I have a challanage:

 write a script that takes a folder that contains a static html file
 and converts it into an HTML site.

 1) moves all non .html files into static/
 2) moves all .html files into views/xxx/
 3) creates a controllers/xxx.py and for each yyy.html file add an
 action

 def yyy(): return dict()

 4) loop over all .html files and fixes all the URL to {{=URL(...)}}}

 OPTIONAL:
 5)
 If all .html files start with a similar header and footer, tried to
 identify them, moves header{{include}}footer into views/
 layout.html and rewrite the html files to {{extend 'layout.html'}}

 The original folder and 'xxx' should be uer defined. This could be
 added to the wizard.

 Massimo


Re: [web2py] Re: detect user login

2010-11-24 Thread Richard Vézina
If I go like this :

@auth.requires_login()
def index():
*auth.messages.logged_in=T('Hello ')*

Index page using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html

#auth.messages.logged_in=DIV(T('Hello '),
#str(auth.user and auth.user.first_name),
#BR(),
#T('Welcome on the '),
#appTitle)
if auth.user and auth.user.first_name!=0:
response.flash
if not response.flash: response.flash = T('Hello')
return dict(message=T(''))
#return redirect(URL(request.application,'accueil','index')) # Here
redirect on app/accueil/index

I get web2py the default auth.messages.logged_in  : connected or something
like that.

Outside the index function it get Hello None user :

auth.messages.logged_in=T('Hello ')+str(auth.user and auth.user.first_name)

@auth.requires_login()
def index():

Index page using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html

#auth.messages.logged_in=DIV(T('Hello '),
#str(auth.user and auth.user.first_name),
#BR(),
#T('Welcome on the '),
#appTitle)
if auth.user and auth.user.first_name!=0:
response.flash
if not response.flash: response.flash = T('Hello')
return dict(message=T(''))
#return redirect(URL(request.application,'accueil','index')) # Here
redirect on app/accueil/index


Richard

On Wed, Nov 24, 2010 at 2:24 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 I get :
 Hello %(first_name)s

 in flash response with this in default.py :

 auth.messages.logged_in=T('Hello %(first_name)s')#+str(auth.user and
 auth.user.first_name))

 @auth.requires_login()
 def index():
 
 Index page using the internationalization operator T and flash
 rendered by views/default/index.html or views/generic.html
 
 #auth.messages.logged_in=DIV(T('Hello '),
 #str(auth.user and auth.user.first_name),
 #BR(),
 #T('Welcome on the '),
 #appTitle)
 if auth.user and auth.user.first_name!=0:
 response.flash
 if not response.flash: response.flash = T('Hello')
 return dict(message=T(''))

 Richard

 On Wed, Nov 24, 2010 at 12:19 PM, mdipierro mdipie...@cs.depaul.eduwrote:

 What does not working mean for you?

 That is not the code I asked you to try. This does not help isolate
 the issue since you have everything in this message (helpers, T,
 strings, session, auth variables). Try with a simple string first.


 On Nov 24, 11:09 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  You meen that this, any where in controllers
 
  auth.messages.logged_in=DIV(T('Hello '),
  str(auth.user and auth.user.first_name),
  BR(),
  T('Welcome on the '),
  appTitle,
  session.counter)
 
  Should prompt in response.flash once at login?
 
  Not working for me...
 
  Richard
 
  On Wed, Nov 24, 2010 at 12:06 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   Well be used to set the flash immediately after login. You can put it
   anywere you want (models or same controller as user action) and should
   work.
 
   On Nov 24, 10:56 am, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
How do I get the auth.messages.logged_in in response.flash only at
 login?
 
I try many different things without success.
 
Is auth.messages.logged_in as to be put in auth form controller?
 
On Wed, Nov 24, 2010 at 11:18 AM, mdipierro 
 mdipie...@cs.depaul.edu
   wrote:
 how about something like this?
 
 auth.messages.logged_in=T('Hello %(first_name)s and welcome on the
 '+appTitle')
 
 def index():

Index page

session.counter = (session.counter or 0) + 1
if auth.user and auth.user.first_name!=0 and
 session.counter=0:
 pass
 elif session.counter0:
pass
else:
 if not response.flash: response.flash = T('Hello')
return dict(message=T(''))
 
 On Nov 24, 10:05 am, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  Hello
 
  I need to have a response.flash on index page at login but not
 when
   the
 user
  come back on index page during a session. I try to user
   session.counter
 but
  the session is not reset until the cookies are erase I think.
 
  Here my index controller (*not working*) :
 
  def index():
  
  Index page
  
  session.counter = (session.counter or 0) + 1
  if auth.user and auth.user.first_name!=0 and
 session.counter=0:
  response.flash = DIV(T('Hello ')+str(auth.user and
  auth.user.first_name),BR(),T('Welcome on the '),appTitle)
  elif session.counter0:
  pass
  else:
  response.flash = T('Hello')
  return 

[web2py] Re: exercise: automatic conversion of a static site into a web2py site

2010-11-24 Thread mart
scons... good one  :)


Mart :)

On Nov 24, 3:52 pm, Michele Comitini michele.comit...@gmail.com
wrote:
 Is this a oneshot?
 Else I would go scons
 (http://www.scons.org/doc/production/HTML/scons-user/index.html)

 2010/11/24 mart msenecal...@gmail.com:

  can you provide a sample folder + contents?

  Mart :)

  On Nov 24, 3:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:
  I have a challanage:

  write a script that takes a folder that contains a static html file
  and converts it into an HTML site.

  1) moves all non .html files into static/
  2) moves all .html files into views/xxx/
  3) creates a controllers/xxx.py and for each yyy.html file add an
  action

  def yyy(): return dict()

  4) loop over all .html files and fixes all the URL to {{=URL(...)}}}

  OPTIONAL:
  5)
  If all .html files start with a similar header and footer, tried to
  identify them, moves header{{include}}footer into views/
  layout.html and rewrite the html files to {{extend 'layout.html'}}

  The original folder and 'xxx' should be uer defined. This could be
  added to the wizard.

  Massimo




Re: [web2py] Re: send attachment via xmlrpclib

2010-11-24 Thread António Ramos
but if  i want, using the shell, to add and image manually
do i use
db.photo.insert('file'=varwithFile)
?

*my test model is
db.define_table('photo',
Field('file','upload'))*

Best regards
António


[web2py] Re: Viewing tickets on GAE devserver

2010-11-24 Thread howesc
on the development server i see all my errors on the console (i use
the command line so it shows up right in the terminal window.  i
believe that the mac launcher has a console view that shows this info
as well)

in production everything is logged to the error logs.  click on the
logs link on the left side of the admin screen for your app.  it
defaults to showing requests with errors (uncaught exceptions or
logging.error messages)

cfh

On Nov 24, 8:15 am, Narendran gunanar...@gmail.com wrote:
 Hello,
 I've deployed a Web2Py app on the GAE, and it works fine. I'm trying
 to run web2py now on my local machine using GAE's devserver, and due
 to some reason, I keep getting a Web2py error ticket. Now the problem
 is I am not able to open the tkt due to lack of SSL. Is there some way
 I can see the tickets?
 And also, how do I see the error tickets on the prod GAE instance?
 Couldn't find much material around this. Pointers would be
 appreciated.

 --
 Thanks
 Narendran


[web2py] personnalize login page

2010-11-24 Thread Richard Vézina
Hello,

Is there a way to have a particular layout for default/user/login that will
not affect ddefault/user/not_authorized for example?

I try by adding a login.html in view without success.

Thanks

Richard


[web2py] Re: token_url domain not in whitelist

2010-11-24 Thread mdipierro
In the janrain configuration page there is a list of allowed domains.
You did not list

http://www.em-ecommmerce.com

On Nov 24, 2:13 pm, Andrew Evans randra...@gmail.com wrote:
 Figured I would start a different post for this :-)

 Don't know if there is a problem in my Janrain account or if it exists in
 web2py

 but I get the following error

 token_url domain not in whitelist

 my domains are set in janrain towww.em-ecommerce.comandwww.suck-o.de

 and my code is like this

 from gluon.contrib.login_methods.rpx_account import RPXAccount
 auth.settings.actions_disabled=['register','change_password','request_reset_password']
 auth.settings.login_form = RPXAccount(request,
     api_key='...',
     domain='em',
     url = http://www.em-ecommmerce.com/%s/default/user/login; %
 request.application)

 any ideas as to the error

 *cheers


[web2py] Re: redirect using a new window

2010-11-24 Thread mdipierro
or

a href={{=URL(...)}} target=newclick me/a

On Nov 24, 2:47 pm, Michele Comitini michele.comit...@gmail.com
wrote:
 do you mean like this?

 {{=A('click me!', _href=URL(...), _target='new')}}

 2010/11/24 leone handja...@gmail.com:

  Hi,
  there is a way to redirect to a new page simulating A ,
  target='new' using URL()
  or a controller function???
  Thanks
  leone




Re: [web2py] personnalize login page

2010-11-24 Thread Bruno Rocha
You have to customize the user.html which receive 'login' as an argument in
request.args, so you can control your behavior in user.html as:

{{if 'login' in request.args:}}

SOME HTML

{{else:}}

OTHER HTML

{{pass}}

2010/11/24 Richard Vézina ml.richard.vez...@gmail.com

 Hello,

 Is there a way to have a particular layout for default/user/login that will
 not affect ddefault/user/not_authorized for example?

 I try by adding a login.html in view without success.

 Thanks

 Richard




-- 

Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: exercise: automatic conversion of a static site into a web2py site

2010-11-24 Thread mdipierro
I would like this to be a pure python module with no dependencies. It
does not require html parsing just pattern matching (re.sub()).

Massimo

On Nov 24, 2:52 pm, Michele Comitini michele.comit...@gmail.com
wrote:
 Is this a oneshot?
 Else I would go scons
 (http://www.scons.org/doc/production/HTML/scons-user/index.html)

 2010/11/24 mart msenecal...@gmail.com:

  can you provide a sample folder + contents?

  Mart :)

  On Nov 24, 3:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:
  I have a challanage:

  write a script that takes a folder that contains a static html file
  and converts it into an HTML site.

  1) moves all non .html files into static/
  2) moves all .html files into views/xxx/
  3) creates a controllers/xxx.py and for each yyy.html file add an
  action

  def yyy(): return dict()

  4) loop over all .html files and fixes all the URL to {{=URL(...)}}}

  OPTIONAL:
  5)
  If all .html files start with a similar header and footer, tried to
  identify them, moves header{{include}}footer into views/
  layout.html and rewrite the html files to {{extend 'layout.html'}}

  The original folder and 'xxx' should be uer defined. This could be
  added to the wizard.

  Massimo




Re: [web2py] personnalize login page

2010-11-24 Thread Albert Abril
Or  using auth.login() in your controller/view instead of auth().


On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Hello,

 Is there a way to have a particular layout for default/user/login that will
 not affect ddefault/user/not_authorized for example?

 I try by adding a login.html in view without success.

 Thanks

 Richard



Re: [web2py] personnalize login page

2010-11-24 Thread Richard Vézina
I have this :

{{if request.args(0)=='login':}}
{{layoutPassed = 'login_layout.html'}}
{{=P(0)}}
{{else:}}
{{=P(1)}}
{{pass}}
{{pass}}

{{extend layoutPassed}}

{{=form}}

and I get :

Error traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.

Traceback (most recent call last):
  File /web2py/gluon/main.py, line 425, in wsgibase
serve_controller(request, response, session)
  File /web2py/gluon/main.py, line 194, in serve_controller
run_view_in(response._view_environment)
  File /web2py/gluon/compileapp.py, line 471, in run_view_in
context=environment)
  File /web2py/gluon/template.py, line 821, in parse_template
return str(TemplateParser(text, context=context, path=path,
lexers=lexers, delimiters=delimiters))
  File /web2py/gluon/template.py, line 310, in __init__
self.parse(text)
  File /web2py/gluon/template.py, line 794, in parse
self.extend(extend)
  File /web2py/gluon/template.py, line 465, in extend
text = self._get_file_text(filename)
  File /web2py/gluon/template.py, line 428, in _get_file_text
filename = eval(filename, self.context)
  File string, line 1, in module
NameError: name 'layoutPassed' is not defined


Richard

On Wed, Nov 24, 2010 at 5:21 PM, Bruno Rocha rochacbr...@gmail.com wrote:

 You have to customize the user.html which receive 'login' as an argument in
 request.args, so you can control your behavior in user.html as:

 {{if 'login' in request.args:}}

 SOME HTML

 {{else:}}

 OTHER HTML

 {{pass}}

 2010/11/24 Richard Vézina ml.richard.vez...@gmail.com

 Hello,

 Is there a way to have a particular layout for default/user/login that
 will not affect ddefault/user/not_authorized for example?

 I try by adding a login.html in view without success.

 Thanks

 Richard




 --

 Bruno Rocha
 http://about.me/rochacbruno/bio



RE: [web2py] Re: targeted web2py_ajax_init for dynamically inserted forms

2010-11-24 Thread Josh Jaques
Background on jQuery live:
-
The classic way to bind to an event is doing something like:
jQuery(selector).click(function() { 
// do some stuff
});
//Note this is just a wrapper to jQuery(...).bind(click, ...);

The issue with that method is that it statically binds the event to whatever 
elements match your selector AT THE TIME YOU CALL .click(). So if new elements 
are dynamically added to the page using javascript, the event handler won't be 
attached to those new elements. jQuery also has the .live function, where 
events can be bound as follows:
jQuery(selector).live(click, function() {
// do some stuff
}
Using .live(), the click event is now dynamically attached to all elements that 
match selector, regardless of the time they are added to the page.

The issue I was having:
--
So in my example, since web2py initializes its form event handlers with .bind, 
when I load a new form onto the page via ajax then it doesn't have any of the 
event handlers attached to it. This means the date fields are all static, 
delete checkboxes have no confirmation, etc.

What are thoughts on attaching the events using .live() instead. The only 
drawback to .live() I can think of is the increase in performance cost required 
to support dynamic events.

If you want to make it the new default, I'll submit patch.

-Original Message-
From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of 
mdipierro
Sent: Wednesday, November 24, 2010 12:51 PM
To: web2py-users
Subject: [web2py] Re: targeted web2py_ajax_init for dynamically inserted forms

tell us more about jquery live. What do you propose?

On Nov 24, 11:44 am, Josh Jaques jjaq...@seccuris.com wrote:
 If you load a form onto a web2py page via AJAX, it doesn't get the 
 enhancements from web2py_ajax_init().

 I've included a modified web2py_ajax_init that accepts an optional parent 
 selector to provide some scope to web2py_ajax_init. In this way if you load a 
 form onto a page, you can call web2py_ajax_init on that specific form to give 
 it the enhancements, without effecting every other form on the page.

 I've included the modified function here as it may be useful to others in the 
 future.

 An alternative approach may be to bind events using jQuery.live(), so that 
 you don't have to explicitly call web2py_ajax_init() every time you load a 
 form.

 
 function web2py_ajax_ init(parent) {
   var find = function(selector) {
       if (parent)
           return $(parent).find(selector);
       else
           return jQuery(selector);
   }
   find('.hidden').hide();
   find('.error').hide().slideDown('slow');
   find('.flash').click(function() { find(this).fadeOut('slow'); return false; 
 });
   // find('input[type=submit]').click(function(){var 
 t=find(this);t.hide();t.after('input class=submit_disabled 
 disabled=disabled type=submit name='+t.attr(name)+'_dummy 
 value='+t.val()+'')});
   
 find('input.integer').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
   
 find('input.double,input.decimal').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,'').reverse();});
   
 find(input[type='checkbox'].delete).each(function(){find(this).click(function()
  { if(this.checked) if(!confirm({{=T('Sure you want to delete this 
 object?')}})) this.checked=false; });});
   try {find(input.date).focus(function() {Calendar.setup({
      inputField:this.id, ifFormat:{{=T('%Y-%m-%d')}}, showsTime:false
   }); }); } catch(e) {};
   try { find(input.datetime).focus( function() {Calendar.setup({
      inputField:this.id, ifFormat:{{=T('%Y-%m-%d %H:%M:%S')}}, showsTime: 
 true,timeFormat: 24
   }); }); } catch(e) {};
   try { find(input.time).timeEntry(); } catch(e) {};};

 ---

 This communication, including any attachments, does not necessarily represent 
 official policy of Seccuris Inc.
 Please seehttp://www.seccuris.com/Contact-PrivacyPolicy.htm for further 
 details about Seccuris Inc.'s Privacy Policy.
 If you have received this communication in error, please notify Seccuris Inc. 
 at i...@seccuris.com or at 1-866-644-8442.
This communication, including any attachments, does not necessarily represent 
official policy of Seccuris Inc.
Please see http://www.seccuris.com/Contact-PrivacyPolicy.htm  for further 
details about Seccuris Inc.'s Privacy Policy.
If you have received this communication in error, please notify Seccuris Inc. 
at i...@seccuris.com or at 1-866-644-8442.


[web2py] Re: exercise: automatic conversion of a static site into a web2py site

2010-11-24 Thread mdipierro
something like this

def convert(source, destination, c='xxx'):
links=[]
actions=[]
for file in source folder (traverse tree):
if not file.endswith('.html'):
copy file under destination/static (and create missing
folders)
links.append(file)
for file in source folder (traverse tree):
if file.endswith('.html'):
actions.append(file[:-5])
data = open(file) and read
for link in links:
data=data.replace(link,URL('static',link))
write data in file under destination/views/c
data='\n'.join('def %s():return dict()' % a for a in actions)
write data in file under destination/controllers/c.py

Massimo


On Nov 24, 2:52 pm, Michele Comitini michele.comit...@gmail.com
wrote:
 Is this a oneshot?
 Else I would go scons
 (http://www.scons.org/doc/production/HTML/scons-user/index.html)

 2010/11/24 mart msenecal...@gmail.com:

  can you provide a sample folder + contents?

  Mart :)

  On Nov 24, 3:05 pm, mdipierro mdipie...@cs.depaul.edu wrote:
  I have a challanage:

  write a script that takes a folder that contains a static html file
  and converts it into an HTML site.

  1) moves all non .html files into static/
  2) moves all .html files into views/xxx/
  3) creates a controllers/xxx.py and for each yyy.html file add an
  action

  def yyy(): return dict()

  4) loop over all .html files and fixes all the URL to {{=URL(...)}}}

  OPTIONAL:
  5)
  If all .html files start with a similar header and footer, tried to
  identify them, moves header{{include}}footer into views/
  layout.html and rewrite the html files to {{extend 'layout.html'}}

  The original folder and 'xxx' should be uer defined. This could be
  added to the wizard.

  Massimo




Re: [web2py] personnalize login page

2010-11-24 Thread Richard Vézina
{{if request.args(0)=='login':}}
{{=P(0)}}
{{extend 'login_layout.html'}}
{{else:}}
{{=P(1)}}
{{extend 'layout.html'}}
{{pass}}

{{=form}}

It always take the second layout...

Richard

On Wed, Nov 24, 2010 at 5:25 PM, Albert Abril albert.ab...@gmail.comwrote:

 Or  using auth.login() in your controller/view instead of auth().


 On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Hello,

 Is there a way to have a particular layout for default/user/login that
 will not affect ddefault/user/not_authorized for example?

 I try by adding a login.html in view without success.

 Thanks

 Richard





[web2py] Re: targeted web2py_ajax_init for dynamically inserted forms

2010-11-24 Thread mdipierro
I think it would be a good idea to switch to live. If you have a patch
send it to me and I will take a look.


On Nov 24, 4:26 pm, Josh Jaques jjaq...@seccuris.com wrote:
 Background on jQuery live:
 -
 The classic way to bind to an event is doing something like:
 jQuery(selector).click(function() {
         // do some stuff});

 //Note this is just a wrapper to jQuery(...).bind(click, ...);

 The issue with that method is that it statically binds the event to whatever 
 elements match your selector AT THE TIME YOU CALL .click(). So if new 
 elements are dynamically added to the page using javascript, the event 
 handler won't be attached to those new elements. jQuery also has the .live 
 function, where events can be bound as follows:
 jQuery(selector).live(click, function() {
         // do some stuff}

 Using .live(), the click event is now dynamically attached to all elements 
 that match selector, regardless of the time they are added to the page.

 The issue I was having:
 --
 So in my example, since web2py initializes its form event handlers with 
 .bind, when I load a new form onto the page via ajax then it doesn't have any 
 of the event handlers attached to it. This means the date fields are all 
 static, delete checkboxes have no confirmation, etc.

 What are thoughts on attaching the events using .live() instead. The only 
 drawback to .live() I can think of is the increase in performance cost 
 required to support dynamic events.

 If you want to make it the new default, I'll submit patch.

 -Original Message-
 From: web2py@googlegroups.com [mailto:web...@googlegroups.com] On Behalf Of 
 mdipierro
 Sent: Wednesday, November 24, 2010 12:51 PM
 To: web2py-users
 Subject: [web2py] Re: targeted web2py_ajax_init for dynamically inserted forms

 tell us more about jquery live. What do you propose?

 On Nov 24, 11:44 am, Josh Jaques jjaq...@seccuris.com wrote:
  If you load a form onto a web2py page via AJAX, it doesn't get the 
  enhancements from web2py_ajax_init().

  I've included a modified web2py_ajax_init that accepts an optional parent 
  selector to provide some scope to web2py_ajax_init. In this way if you load 
  a form onto a page, you can call web2py_ajax_init on that specific form to 
  give it the enhancements, without effecting every other form on the page.

  I've included the modified function here as it may be useful to others in 
  the future.

  An alternative approach may be to bind events using jQuery.live(), so that 
  you don't have to explicitly call web2py_ajax_init() every time you load a 
  form.

  
  function web2py_ajax_ init(parent) {
    var find = function(selector) {
        if (parent)
            return $(parent).find(selector);
        else
            return jQuery(selector);
    }
    find('.hidden').hide();
    find('.error').hide().slideDown('slow');
    find('.flash').click(function() { find(this).fadeOut('slow'); return 
  false; });
    // find('input[type=submit]').click(function(){var 
  t=find(this);t.hide();t.after('input class=submit_disabled 
  disabled=disabled type=submit name='+t.attr(name)+'_dummy 
  value='+t.val()+'')});
    
  find('input.integer').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
    
  find('input.double,input.decimal').keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,'').reverse();});
    
  find(input[type='checkbox'].delete).each(function(){find(this).click(function()
   { if(this.checked) if(!confirm({{=T('Sure you want to delete this 
  object?')}})) this.checked=false; });});
    try {find(input.date).focus(function() {Calendar.setup({
       inputField:this.id, ifFormat:{{=T('%Y-%m-%d')}}, showsTime:false
    }); }); } catch(e) {};
    try { find(input.datetime).focus( function() {Calendar.setup({
       inputField:this.id, ifFormat:{{=T('%Y-%m-%d %H:%M:%S')}}, showsTime: 
  true,timeFormat: 24
    }); }); } catch(e) {};
    try { find(input.time).timeEntry(); } catch(e) {};};

  ---

  This communication, including any attachments, does not necessarily 
  represent official policy of Seccuris Inc.
  Please seehttp://www.seccuris.com/Contact-PrivacyPolicy.htm for further 
  details about Seccuris Inc.'s Privacy Policy.
  If you have received this communication in error, please notify Seccuris 
  Inc. at i...@seccuris.com or at 1-866-644-8442.
 This communication, including any attachments, does not necessarily represent 
 official policy of Seccuris Inc.
 Please seehttp://www.seccuris.com/Contact-PrivacyPolicy.htm for further 
 details about Seccuris Inc.'s Privacy Policy.
 If you have received this communication in error, please notify Seccuris Inc. 
 at i...@seccuris.com or at 1-866-644-8442.




[web2py] Re: personnalize login page

2010-11-24 Thread mdipierro
Extend is hanndled by the preprocessor before the if is executed.

You can do

{{extend layout}}

and set the layout variable in the controller. This will not work if
you bytecode compile it.

On Nov 24, 4:31 pm, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 {{if request.args(0)=='login':}}
 {{=P(0)}}
 {{extend 'login_layout.html'}}
 {{else:}}
 {{=P(1)}}
 {{extend 'layout.html'}}
 {{pass}}

 {{=form}}

 It always take the second layout...

 Richard

 On Wed, Nov 24, 2010 at 5:25 PM, Albert Abril albert.ab...@gmail.comwrote:

  Or  using auth.login() in your controller/view instead of auth().

  On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina 
  ml.richard.vez...@gmail.com wrote:

  Hello,

  Is there a way to have a particular layout for default/user/login that
  will not affect ddefault/user/not_authorized for example?

  I try by adding a login.html in view without success.

  Thanks

  Richard




Re: [web2py] personnalize login page

2010-11-24 Thread Richard Vézina
I had error should be :

But not solve the problem I face.

richard

On Wed, Nov 24, 2010 at 5:26 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 I have this :

 {{if request.args(0)=='login':}}
 {{layoutPassed = 'login_layout.html'}}
 {{=P(0)}}
 {{else:}}

* {{layoutPassed = 'layout.html'}}*

 {{=P(1)}}
 {{pass}}
 {{pass}}

 {{extend layoutPassed}}

 {{=form}}

 and I get :

 Error traceback

 1.
 2.

 3.
 4.

 5.
 6.

 7.
 8.

 9.
 10.

 11.
 12.

 13.
 14.

 15.
 16.

 17.
 18.

 19.
 20.

 Traceback (most recent call last):

   File /web2py/gluon/main.py, line 425, in wsgibase

 serve_controller(request, response, session)

   File /web2py/gluon/main.py, line 194, in serve_controller

 run_view_in(response._view_environment)

   File /web2py/gluon/compileapp.py, line 471, in run_view_in

 context=environment)

   File /web2py/gluon/template.py, line 821, in parse_template

 return str(TemplateParser(text, context=context, path=path, 
 lexers=lexers, delimiters=delimiters))

   File /web2py/gluon/template.py, line 310, in __init__

 self.parse(text)

   File /web2py/gluon/template.py, line 794, in parse

 self.extend(extend)

   File /web2py/gluon/template.py, line 465, in extend

 text = self._get_file_text(filename)

   File /web2py/gluon/template.py, line 428, in _get_file_text

 filename = eval(filename, self.context)

   File string, line 1, in module
 NameError: name 'layoutPassed' is not defined


 Richard

 On Wed, Nov 24, 2010 at 5:21 PM, Bruno Rocha rochacbr...@gmail.comwrote:

 You have to customize the user.html which receive 'login' as an argument
 in request.args, so you can control your behavior in user.html as:

 {{if 'login' in request.args:}}

 SOME HTML

 {{else:}}

 OTHER HTML

 {{pass}}

 2010/11/24 Richard Vézina ml.richard.vez...@gmail.com

 Hello,

 Is there a way to have a particular layout for default/user/login that
 will not affect ddefault/user/not_authorized for example?

 I try by adding a login.html in view without success.

 Thanks

 Richard




 --

 Bruno Rocha
 http://about.me/rochacbruno/bio





Re: [web2py] Re: personnalize login page

2010-11-24 Thread Richard Vézina
http://www.mail-archive.com/web2py@googlegroups.com/msg47106.html

http://www.mail-archive.com/web2py@googlegroups.com/msg47106.htmlI read
this thread can't figure out I to do it.

In {{extend layout}}
layout is a variable or a function?

Richard

On Wed, Nov 24, 2010 at 5:32 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 Extend is hanndled by the preprocessor before the if is executed.

 You can do

 {{extend layout}}

 and set the layout variable in the controller. This will not work if
 you bytecode compile it.

 On Nov 24, 4:31 pm, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  {{if request.args(0)=='login':}}
  {{=P(0)}}
  {{extend 'login_layout.html'}}
  {{else:}}
  {{=P(1)}}
  {{extend 'layout.html'}}
  {{pass}}
 
  {{=form}}
 
  It always take the second layout...
 
  Richard
 
  On Wed, Nov 24, 2010 at 5:25 PM, Albert Abril albert.ab...@gmail.com
 wrote:
 
   Or  using auth.login() in your controller/view instead of auth().
 
   On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina 
   ml.richard.vez...@gmail.com wrote:
 
   Hello,
 
   Is there a way to have a particular layout for default/user/login that
   will not affect ddefault/user/not_authorized for example?
 
   I try by adding a login.html in view without success.
 
   Thanks
 
   Richard
 
 



[web2py] Re: personnalize login page

2010-11-24 Thread mdipierro
def user():
layout=
form=auth()
return dict(form=form,layout=layout)

On Nov 24, 4:34 pm, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 http://www.mail-archive.com/web2py@googlegroups.com/msg47106.html

 http://www.mail-archive.com/web2py@googlegroups.com/msg47106.htmlI read
 this thread can't figure out I to do it.

 In {{extend layout}}
 layout is a variable or a function?

 Richard

 On Wed, Nov 24, 2010 at 5:32 PM, mdipierro mdipie...@cs.depaul.edu wrote:
  Extend is hanndled by the preprocessor before the if is executed.

  You can do

  {{extend layout}}

  and set the layout variable in the controller. This will not work if
  you bytecode compile it.

  On Nov 24, 4:31 pm, Richard Vézina ml.richard.vez...@gmail.com
  wrote:
   {{if request.args(0)=='login':}}
   {{=P(0)}}
   {{extend 'login_layout.html'}}
   {{else:}}
   {{=P(1)}}
   {{extend 'layout.html'}}
   {{pass}}

   {{=form}}

   It always take the second layout...

   Richard

   On Wed, Nov 24, 2010 at 5:25 PM, Albert Abril albert.ab...@gmail.com
  wrote:

Or  using auth.login() in your controller/view instead of auth().

On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

Hello,

Is there a way to have a particular layout for default/user/login that
will not affect ddefault/user/not_authorized for example?

I try by adding a login.html in view without success.

Thanks

Richard




Re: [web2py] Re: personnalize login page

2010-11-24 Thread Richard Vézina
Finally

def user():

exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
http:///[app]/default/user/not_authorized
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control

form=auth()
if request.args(0) == 'login':
return dict(form=form,layout='login_layout.html')
else:
return dict(form=form,layout='layout.html')
if request.args[0] == 'profile':
return dict(form='you are not allowed
(permission)',layout='layout.html')
return dict(form=form,layout='layout.html')

and

user.html :

{{extend layout}}

{{=form}}


I was about to get there before I got you mail Massimo... [?]

Thanks all!

Richard


On Wed, Nov 24, 2010 at 5:35 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 def user():
layout=
form=auth()
return dict(form=form,layout=layout)

 On Nov 24, 4:34 pm, Richard Vézina ml.richard.vez...@gmail.com
 wrote:
  http://www.mail-archive.com/web2py@googlegroups.com/msg47106.html
 
  http://www.mail-archive.com/web2py@googlegroups.com/msg47106.htmlI
 read
  this thread can't figure out I to do it.
 
  In {{extend layout}}
  layout is a variable or a function?
 
  Richard
 
  On Wed, Nov 24, 2010 at 5:32 PM, mdipierro mdipie...@cs.depaul.edu
 wrote:
   Extend is hanndled by the preprocessor before the if is executed.
 
   You can do
 
   {{extend layout}}
 
   and set the layout variable in the controller. This will not work if
   you bytecode compile it.
 
   On Nov 24, 4:31 pm, Richard Vézina ml.richard.vez...@gmail.com
   wrote:
{{if request.args(0)=='login':}}
{{=P(0)}}
{{extend 'login_layout.html'}}
{{else:}}
{{=P(1)}}
{{extend 'layout.html'}}
{{pass}}
 
{{=form}}
 
It always take the second layout...
 
Richard
 
On Wed, Nov 24, 2010 at 5:25 PM, Albert Abril 
 albert.ab...@gmail.com
   wrote:
 
 Or  using auth.login() in your controller/view instead of auth().
 
 On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:
 
 Hello,
 
 Is there a way to have a particular layout for default/user/login
 that
 will not affect ddefault/user/not_authorized for example?
 
 I try by adding a login.html in view without success.
 
 Thanks
 
 Richard
 
 

330.gif

[web2py] Re: send attachment via xmlrpclib

2010-11-24 Thread mdipierro
No


filename = request.vars.varwithFile.filename or 'filename.txt'
stream = request.vars.varwithFile.file or open(filename,'rb')
db.photo.insert(file=db.photo.file.store(stream),filename=filename)


On Nov 24, 3:37 pm, António Ramos ramstei...@gmail.com wrote:
 but if  i want, using the shell, to add and image manually
 do i use
 db.photo.insert('file'=varwithFile)
 ?

 *my test model is
 db.define_table('photo',
     Field('file','upload'))*

 Best regards
 António


[web2py] Re: Viewing tickets on GAE devserver

2010-11-24 Thread mdipierro
Perhaps a web2py.py -E error would be enough.

On Nov 24, 3:38 pm, howesc how...@umich.edu wrote:
 on the development server i see all my errors on the console (i use
 the command line so it shows up right in the terminal window.  i
 believe that the mac launcher has a console view that shows this info
 as well)

 in production everything is logged to the error logs.  click on the
 logs link on the left side of the admin screen for your app.  it
 defaults to showing requests with errors (uncaught exceptions or
 logging.error messages)

 cfh

 On Nov 24, 8:15 am, Narendran gunanar...@gmail.com wrote:

  Hello,
  I've deployed a Web2Py app on the GAE, and it works fine. I'm trying
  to run web2py now on my local machine using GAE's devserver, and due
  to some reason, I keep getting a Web2py error ticket. Now the problem
  is I am not able to open the tkt due to lack of SSL. Is there some way
  I can see the tickets?
  And also, how do I see the error tickets on the prod GAE instance?
  Couldn't find much material around this. Pointers would be
  appreciated.

  --
  Thanks
  Narendran




Re: [web2py] Re: token_url domain not in whitelist

2010-11-24 Thread Andrew Evans
hello ty for your help

I had mistyped the url in my code. But now I am faced with a new problem
when I log in it seems to work but then returns an invalid request
message.

Any ideas whats up

would this have to with routes?

*cheers


Re: [web2py] Re: send attachment via xmlrpclib

2010-11-24 Thread António Ramos
i got xmlrpclib to transfer a file from python script to web2py app

Here is my code
*Python script*
import xmlrpclib
server = xmlrpclib.ServerProxy('
http://127.0.0.1:8000/CrossValidation1/default/call/xmlrpc')
filepath='c:\\'
filename='ico.gif'
filebin = xmlrpclib.Binary(open(filepath+filename).read())
server.checkflow(filebin,filename)
*
and in my default.py controller*


import xmlrpclib

import os
@service.xmlrpc
def checkflow(file,name):
basedir= request.folder.replace('/','')
f=open(basedir+'\\uploads\\'+name,'wb')
db.image.insert(file=name)
f.write(file.data)
f.close()
print ok
return name

def call():
session.forget()
return service()
*
my model*
*
*db.define_table('image',
Field('file','upload'))


Is this a good practice?


2010/11/24 mdipierro mdipie...@cs.depaul.edu

 No


 filename = request.vars.varwithFile.filename or 'filename.txt'
 stream = request.vars.varwithFile.file or open(filename,'rb')
 db.photo.insert(file=db.photo.file.store(stream),filename=filename)


 On Nov 24, 3:37 pm, António Ramos ramstei...@gmail.com wrote:
  but if  i want, using the shell, to add and image manually
  do i use
  db.photo.insert('file'=varwithFile)
  ?
 
  *my test model is
  db.define_table('photo',
  Field('file','upload'))*
 
  Best regards
  António



[web2py] Problem starting server web2py

2010-11-24 Thread Marcos Vinhal
Every time I try to start the server web2py shows the message below:

---
web2py start server
---
global name 'rocket' is not defined
---
OK
---

Please help me if possible ...

Thanks ...


  1   2   >