[web2py] R: Re: R: Re: R: Re: Web Shell problem on Mozilla Firefox 5 and Internet Explorer 9 (PC with Vista)

2011-07-12 Thread Valter Foresto
I would like to use the console as a substitute for the Web Shell.
Can I interact with my application using a web-browser when I use the 
standard console ?

- Valter


Re: [web2py] web2py deployement on windows

2011-07-12 Thread cjrh
I think we can fill in defaults for IP and port, and only require a user to 
hit accept if they agree.  So that should make things even easier to just 
get started.  Also, the time that the splash logo is displayed is actually a 
setting, it isn't busy working during that delay.  I have been considering 
for a while putting a close button (think a small X somewhere) so that 
if you don't want to wait you can just go straight into the little config 
window.

[web2py] Python newbie: is knowledge of network programming must for web development stuff ?

2011-07-12 Thread ArrC
Disclaimer: i have no knowledge of web development like 
cgi,sessions,SQL,cookie,authentication systems etc And i know basic python 
with no prior programming experience.

considering my limited python knowledge will it be a good idea to just jump 
right into using web2py (after reading the official doc,of course) and learn 
form there on or should i gain/read about some topics on web development 
stuffs.

(i dont know how to ask this question)
which web dev thing i should learn about first like sql,user management,ORM 
(i dont know) and which part of python i should learn well before diving 
into web dev like error handling,file I/O,dict etc.

Thanks regards :)


Re: [web2py] Re: 303 See Other - Error while using xmlrpc

2011-07-12 Thread Abhishek Gupta
Hello,

I am still getting the same error. My /etc/apache2/mods-enabled/
wsgi.conf looks like this :

IfModule mod_wsgi.c
WSGIPassAuthorization On
/IfModule


On 12 July 2011 01:15, Robin Marshall robin.d.marsh...@gmail.com wrote:

 I found the problem, it's to do with WSGI - it needs to be configured
 to pass on the authentication data.

 In the configuration file for the module, somewhere like /etc/apache2/
 mods-enabled/wsgi.conf you need to add a line:

 WSGIPassAuthorization On

 and reload apache.

 Cheers,
 Robin

 On Jun 14, 6:30 am, Abhishek Gupta abhishekgupta.i...@gmail.com
 wrote:
  I have the following functions defined in test.py file
 
  @auth.requires_login()
  def call():
  return service()
 
  @service.xmlrpc
  def time():
  import time
  return time.ctime()
 
  and following in my db.py file
  auth.settings.allow_basic_
  login = True  #for CLI access
 
  When I execute the following commands in python shell :
 
  server = ServerProxy( '
  https://username:passw...@10.20.254.39/cloud_computing/test/call/xmlrpc'
 )
  server.time()
 
  I get the following error
 
  Traceback (most recent call last):
File stdin, line 1, in module
File /usr/lib/python2.6/xmlrpclib.py, line 1199, in __call__
  return self.__send(self.__name, args)
File /usr/lib/python2.6/xmlrpclib.py, line 1489, in __request
  verbose=self.__verbose
File /usr/lib/python2.6/xmlrpclib.py, line 1243, in request
  headers
  xmlrpclib.ProtocolError: ProtocolError for
  username:passw...@10.20.254.39/cloud_computing/test/call/xmlrpc: *303
 SEE
  OTHER*
 
  Am, I doing something wrong somewhere?
 
  --
  Abhishekhttp://abhishekgupta92.info




-- 
Abhishek
Webpage http://abhishekgupta92.info/ !!! Bloghttp://thelazy.info/abhishek


[web2py] Re: Paid project: Open source GAE blobstore upload feature in web2py

2011-07-12 Thread anandvc
Thank you so much! I just added this:
http://code.google.com/p/web2py/issues/detail?id=335

- Anand

On Jul 12, 10:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 This is a complex issue. The GAE blobstore has a workflow that
 requires the uploaded file to go through its own form generated by the
 blobstore API. That is different that web2py forms. You can use it but
 you have to use the API.
 Anyway, open a ticket on google code and I will look more into this
 asap.

 On Jul 11, 2:02 am, anandvc anand.chhat...@gmail.com wrote:







  Hello Web2py Wizards,

  I'm making a site using Web2py where vendors upload their product
  images. The site is deployed on Google App Engine (GAE). The problem
  I'm facing is that web2py image uploads on GAE only support files of
  upto 1 mb by default. I currently do not have the in-depth knowledge
  of web2py and python to modify the form generated by the crud.create()
  method so that it supports GAE Blobstore which can store files larger
  than 1 mb on GAE.

  I would like to pay someone to add this feature in web2py and release
  it as open source. It has to be plug and play, i.e. the crud.create
  generated form should know (or have a parameter) that tells it that
  this form is hosted on app engine and automatically it should store
  all files using the blobstore API, even if they are smaller than 1 mb,
  because then even larger files can be uploaded.

  Also, I would like the form view generated to have an Ajax-based or
  Flash-based upload widget with a progress bar and support multiple
  uploads, either in a queue or in-parallel.

  All this should happen without me having to change my currently simple
  code where the model has a bunch of fields of type upload along with
  other fields for product description, controller has a form=
  crud.create() line and the view has {{=form}}.

  Please provide your price+time quotes here in the comments and a link
  to your profile elsewhere where I can get in touch with you to get
  this going. Thank you!

  Regards,

  - Anand

 http://anandvc.com


[web2py] Re: Python newbie: is knowledge of network programming must for web development stuff ?

2011-07-12 Thread Massimo Di Pierro
web2py was designed to teach intro courses on web development. In
principle you just need to read the web2py manual and you do not need
anything else. After you can use and understand web2py you may want to
dig deeper on how http, cookies works. It helps to know how databases
work but you do not need sql because web2py writes it for you and you
do not even see it.

On Jul 12, 1:03 am, ArrC justmailnav...@gmail.com wrote:
 Disclaimer: i have no knowledge of web development like
 cgi,sessions,SQL,cookie,authentication systems etc And i know basic python
 with no prior programming experience.

 considering my limited python knowledge will it be a good idea to just jump
 right into using web2py (after reading the official doc,of course) and learn
 form there on or should i gain/read about some topics on web development
 stuffs.

 (i dont know how to ask this question)
 which web dev thing i should learn about first like sql,user management,ORM
 (i dont know) and which part of python i should learn well before diving
 into web dev like error handling,file I/O,dict etc.

 Thanks regards :)


Re: [web2py] Python 3 and the future of web2py

2011-07-12 Thread cjrh
On Tuesday, July 12, 2011 12:29:19 AM UTC+2, Jonathan Lundell wrote:

 P3 needs some killer feature to motivate a migration, seems to me. 
 Especially when we're hearing from web2py users who need/want to stick with 
 2.4…


I think there are *many* Pythonistas with that view.  I suppose that there 
won't be one single killer feature for 3, but rather a steady accumulation 
of small but useful additions.   Regarding the need for a specific Python 
version: I have been able to get away so far with using my own custom Python 
for web2py deployments, even on shared hosting, so I pretty much choose 
which Python.  I *really* don't want to use 2.4 any more, and even 2.5 has 
some gimpy restrictions on ** kwargs usage.  My standard deploy is currently 
2.6 just because I know all the libraries are available, but I am starting 
to use 2.7.  At least one site is running on 2.7 right now.




[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread cjrh
On Tuesday, July 12, 2011 2:28:10 AM UTC+2, pbreit wrote:

 From the code, it looks like admin is accessible via https *OR* localhost. 
 I had thought localhost was a requirement by default since otherwise it 
 seems too easy to break in to admin by just trying a bunch of passwords. 


Is there a difference in security level between accessing admin over https 
compared to accessing admin over a localhost ssh tunnel?


[web2py] Re: Python newbie: is knowledge of network programming must for web development stuff ?

2011-07-12 Thread ArrC
Thanks Massimo for the reply, now thats a real relief. 

[web2py] Re: Python newbie: is knowledge of network programming must for web development stuff ?

2011-07-12 Thread pbreit
Yes, You can learn to use web2py to create useful web apps very easily with 
just a little bit of python and programming experience. The web2py book is 
terrific and even includes a very brief summary of the python language. The 
great thing is that you an download web2py to your Mac and pc and be 
programming in minutes.


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread pbreit
If I'm not mistaken, without the localhost requirement, a fraudster can go to 
/admin and run a pretty simple dictionary attack since they only need to guess 
the password.


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread cjrh
On Tuesday, July 12, 2011 9:33:13 AM UTC+2, pbreit wrote:

 If I'm not mistaken, without the localhost requirement, a fraudster can go 
 to /admin and run a pretty simple dictionary attack since they only need to 
 guess the password.


Ok, as opposed to being required to know server, user and pass for a similar 
SSH attack?  This is a good point.   Perhaps we should add a slight delay in 
login processing for admin?  At least we can make brute force intractable.


[web2py] Re: default function of a controller

2011-07-12 Thread Francisco Costa
On Jun 14, 7:57 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jun 14, 2011, at 11:42 AM, Francisco Costa wrote:



  You can only do this for the default controller. You do it by specifying a 
  list of the functions in the default controller: functions = [...].

  I have that for the default controller, but in this case I need to
  have it in a non-default controller

  It's not possible to have this feature?

 It's not supported. If someone wants to implement it, I suggest allowing: 
 functions = dict(...) (in addition to a list), where each dict entry would be 
 of the form: controllername = [list of functions]. Be sure to write a set of 
 unit tests.

Any update on this one?


[web2py] break in template not working as expected

2011-07-12 Thread apple
Why does this show hello there on the page?

{{for x in range(6):}}
{{break}}
{{=hello there}}
{{pass}}



[web2py] Re: 303 See Other - Error while using xmlrpc

2011-07-12 Thread Robin Marshall
That is what we added, did you restart apache?

These are the steps we use to recreate the problem:

Step 1 : Configure and expose a test xmlrpc service in web2py:

a) Create a simple web2py application testapp
b) Edit db.py and add the following where auth.settings are
configured

auth.settings.allow_basic_login = True

c) Edit default.py and add @auth.requires_login() to call()

@auth.requires_login()
def call()


d) In default.py, add a function to be exposed as an xmlrpc service.

@service.xmlrpc
def multiply(a=1,b=1):
product = int(a) * int(b)
return dict(answer=product)

e) Create a user in the testapp web application, e.g.
b...@mycompany.com, password = oranges.  This user will be used to
authenticate against the test service.

Step 2 : Invoke XMLRPC service from Python

Assume server is available on localhost:8000.  The path to the XMLRPC
wrapper is testapp/default/call/xmlrpc.

Open a python shell

 from xmlrpclib import ServerProxy

Create a server using format http://user:pass@host:port/path
 server = 
 ServerProxy('http://b...@mycompany.com:oranges@localhost:8000/testapp/default/call/xmlrpc')

Make sure to use https or http as appropriate. To enable logging
of request/response data, create with the named parameter
verbose=True, e.g.
 server = 
 ServerProxy('http://b...@mycompany.com:oranges@localhost:8000/testapp/default/call/xmlrpc',
  verbose=True)

Invoke the multiply() method
 server.multiply(2, 2)

You should see a dictionary containing the answer or, if it's
incorrectly configured, a 303 SEE OTHER error.

Cheers,
Robin

On Jul 12, 5:52 pm, Abhishek Gupta abhishekgupta.i...@gmail.com
wrote:
 Hello,

 I am still getting the same error. My /etc/apache2/mods-enabled/
 wsgi.conf looks like this :

 IfModule mod_wsgi.c
     WSGIPassAuthorization On
 /IfModule

 On 12 July 2011 01:15, Robin Marshall robin.d.marsh...@gmail.com wrote:









  I found the problem, it's to do with WSGI - it needs to be configured
  to pass on the authentication data.

  In the configuration file for the module, somewhere like /etc/apache2/
  mods-enabled/wsgi.conf you need to add a line:

  WSGIPassAuthorization On

  and reload apache.

  Cheers,
  Robin

  On Jun 14, 6:30 am, Abhishek Gupta abhishekgupta.i...@gmail.com
  wrote:
   I have the following functions defined in test.py file

   @auth.requires_login()
   def call():
       return service()

   @service.xmlrpc
   def time():
       import time
       return time.ctime()

   and following in my db.py file
   auth.settings.allow_basic_
   login = True  #for CLI access

   When I execute the following commands in python shell :

   server = ServerProxy( '
   https://username:passw...@10.20.254.39/cloud_computing/test/call/xmlrpc'
  )
   server.time()

   I get the following error

   Traceback (most recent call last):
     File stdin, line 1, in module
     File /usr/lib/python2.6/xmlrpclib.py, line 1199, in __call__
       return self.__send(self.__name, args)
     File /usr/lib/python2.6/xmlrpclib.py, line 1489, in __request
       verbose=self.__verbose
     File /usr/lib/python2.6/xmlrpclib.py, line 1243, in request
       headers
   xmlrpclib.ProtocolError: ProtocolError for
   username:passw...@10.20.254.39/cloud_computing/test/call/xmlrpc: *303
  SEE
   OTHER*

   Am, I doing something wrong somewhere?

   --
   Abhishekhttp://abhishekgupta92.info

 --
 Abhishek
 Webpage http://abhishekgupta92.info/ !!! Bloghttp://thelazy.info/abhishek


Re: [web2py] Re: Python newbie: is knowledge of network programming must for web development stuff ?

2011-07-12 Thread Miguel Lopes
Yes. In my opinion basic Python is the only almost requisite. The book
does a very good job at hand holding, it really helps to know a little
Python (which the book also caters for). My advice is follow along with the
book. If you get stuck by any Python stuff. Take a minute out of web2py and
just solve that issue with Python (at the command line interpreter or with
one of the many excellent shells, e.g. IDLE), then go back. Pretty soon
you'll feel incredibly productive :-)

There's a lot to web development, but the best way is to go and find out as
you feel the need, otherwise you will soon feel overwhelmed.


Re: [web2py] Re: Paid project: Open source GAE blobstore upload feature in web2py

2011-07-12 Thread Martín Mulone
http://www.web2pyslices.com/main/slices/take_slice/63


2011/7/12 anandvc anand.chhat...@gmail.com:
 Thank you so much! I just added this:
 http://code.google.com/p/web2py/issues/detail?id=335

 - Anand

 On Jul 12, 10:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
 This is a complex issue. The GAE blobstore has a workflow that
 requires the uploaded file to go through its own form generated by the
 blobstore API. That is different that web2py forms. You can use it but
 you have to use the API.
 Anyway, open a ticket on google code and I will look more into this
 asap.

 On Jul 11, 2:02 am, anandvc anand.chhat...@gmail.com wrote:







  Hello Web2py Wizards,

  I'm making a site using Web2py where vendors upload their product
  images. The site is deployed on Google App Engine (GAE). The problem
  I'm facing is that web2py image uploads on GAE only support files of
  upto 1 mb by default. I currently do not have the in-depth knowledge
  of web2py and python to modify the form generated by the crud.create()
  method so that it supports GAE Blobstore which can store files larger
  than 1 mb on GAE.

  I would like to pay someone to add this feature in web2py and release
  it as open source. It has to be plug and play, i.e. the crud.create
  generated form should know (or have a parameter) that tells it that
  this form is hosted on app engine and automatically it should store
  all files using the blobstore API, even if they are smaller than 1 mb,
  because then even larger files can be uploaded.

  Also, I would like the form view generated to have an Ajax-based or
  Flash-based upload widget with a progress bar and support multiple
  uploads, either in a queue or in-parallel.

  All this should happen without me having to change my currently simple
  code where the model has a bunch of fields of type upload along with
  other fields for product description, controller has a form=
  crud.create() line and the view has {{=form}}.

  Please provide your price+time quotes here in the comments and a link
  to your profile elsewhere where I can get in touch with you to get
  this going. Thank you!

  Regards,

  - Anand

 http://anandvc.com



-- 
 http://martin.tecnodoc.com.ar


[web2py] Can't get linkto working in SQLFORM

2011-07-12 Thread jc
Hi,
Trying to use linkto, so following example in web2py 
bookhttp://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Records
 first, 
to try to understand.

I have copied the example with person and dog tables, in particular in def 
display_form(): I have

link = URL('list_records')
form = SQLFORM(db.person, record, deletable=True,
  upload=url, linkto=link, labels = {'dog.owner':This 
person's dogs})

as described in the book.

The books says the link generated will be 
/test/default/list_records/dog?query=dog.owner%3D5 but in fact the link 
which appears when I visit /test/default/display_form/1 is 
 /test/default/list_records/dog?query=list_records.dog.owner%3D%3D1, i.e. 
there is a spurious list.records and a spurious %3D. Not surprisingly the 
link doesn't work. Can anybody tell me what I am doing wrong? 

Thanks.


Re: [web2py] Python 3 and the future of web2py

2011-07-12 Thread Ross Peoples
I know that Python 2.5 is the officially supported Python version of web2py, 
but I've been coding all of my stuff with the assumption that this will 
eventually change to Python 2.6, or even 2.7. I have applications running on 
both 2.6 and 2.7 in production. But since I'm using Ubuntu 10.04 Server to 
run most of my sites, Python 2.6.5 is my primary target until the next LTS 
version of Ubuntu Server. Although I've been hearing that the new version of 
Mac OS X Lion will have Python 2.7.

I guess this all goes back to the fact that I think Python 3 is cool because 
it's new, and I'm sure I will start playing with it soon, but no 
distributions are really using or supporting it yet, so it probably will be 
another year or two before any serious Python 3 movement begins (not just 
with web2py). By then, there will probably some kind of huge speed boost, 
or, as you mention, an accumulation of small features that will entice more 
people to start switching to it. I know that it's been out for a while, but 
I still consider it to be somewhat beta since the barrier for entry is so 
high. I'm sure others feel the same way, but again, this will probably 
change soon.


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Ross Peoples
After so many attempts, admin should block the IP address attempting to gain 
access. Further, an invalid password, should require a 5 second timeout. 
After maybe 5 attempts, block the IP. The DenyHosts script that is used to 
prevent SSH brute force attacks does the same thing basically.

[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Ross Peoples
And maybe we should require some level of complexity on the admin passwords. 
The other day I set my dev machine's password to a single letter. I think 
that could be a potential security problem :)

[web2py] Re: default function of a controller

2011-07-12 Thread Ross Peoples
If your controller doesn't have an index function at all, you could add 
something like this to one of your models:

if request.controller = 'mycontroller' and request.function == 'index':
request.function = 'myfunction'

So that if someone tries to go to /mycontroller or /mycontroller/index, they 
will get the 'myfunction' function instead.


[web2py] Ldap and user gruops (Require ldap-group)

2011-07-12 Thread Jose de Soto
Hello,

I am developing a APP  and I would like to use this APP with our LDAP
and filter the users by groups. I have this code in APACHE:

AuthLDAPURL ldap://localhost/ou=users,dc=comain,dc=com?uid
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
AuthzLDAPAuthoritative on
Require ldap-group
cn=developer,cn=testers,cn=groups,dc=domain,dc=com

It works fine. Only people from the list developer and tester can get
inside this area. I am trying to do the same in Web2py, but I can not
make a filter from the groups

I have this code and is working ok without groups:

auth.settings.login_methods=[ldap_auth(mode='uid_r',server='localhost',port='389',
base_dn='ou=users,dc=domain,dc=com', filterstr='objectClass=*')]


I not sure how to use: Require ldap-group in web2py.

Anyone can help me?


In advance many thanks



[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread cjrh
I like the timeout/delay idea for a failed password, and I very much like 
the IP block after a number of failed attempts, but I am not too fond of a 
complexity requirement.  During development on my local machine (bound to 
localhost), my standard admin password is a.  I would have to have to deal 
with a complexity checker during development; and if we then say it will be 
enabled only for production but not dev, then we need more code and 
error-handling to manage the distinction, and it all becomes a lot of work. 
  I think the safeguards that are currently in web2py are quite sufficient, 
and we can improve it a little bit more by penalizing brute force on the 
password, as pbreit pointed out is currently vulnerable.

[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Anthony
On Tuesday, July 12, 2011 3:33:13 AM UTC-4, pbreit wrote: 

 If I'm not mistaken, without the localhost requirement, a fraudster can go 
 to /admin and run a pretty simple dictionary attack since they only need to 
 guess the password.

 
Alternatively, you could just use a strong random password on production 
(and change it periodically). I use Roboform to generate and remember 20+ 
character random passwords (another good option is Lastpass). Even with some 
of the other protections being discussed, this is still a good idea.
 
Anthony


Re: [web2py] Re: Python newbie: is knowledge of network programming must for web development stuff ?

2011-07-12 Thread ArrC


**There's a lot to web development, but the best way is to go and find out 
as you feel the need, otherwise you will soon feel overwhelmed.**

very well said.The world of web development is really big and there are 
no.of techniques and technology to keep track of. 


[web2py] Powertable and virtual columns

2011-07-12 Thread Kenneth Lundström

Hello list,

I´m using Powertable to show a list of records. With virtual columns I 
create links to modify, copy and so on. To save space I´d like to add 
more links into one column.


I´m using:
@virtualsettings(label=T('Edit'))
def edit(self):
return A('Edit', _href=URL('receipt', 'create_receipt', 
args=[self.t_receipt.id]))


to declare a new column, is it possible somehow to return 2 or more links?


Kenneth



[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Ross Peoples
Well, as far as the delay and the blocking of the IP, I put this together, 
which would go somewhere in the /admin/models/access.py file, but I'd like 
to get some comments, as I've never coded this type of thing before so I'd 
like to know if there's a better way to code it, and what problems it might 
cause:

import os, pickle, time 
deny_file = os.path.join(request.folder, 'private', 'hosts.deny') 
denied_hosts = cache.ram('admin_denied_hosts', lambda: read_hosts_deny(), 
time_expire=3600) 

if request.client in denied_hosts: 
if denied_hosts[request.client] = 5: 
raise HTTP(200, T(
'admin disabled because too many invalid password attempts')) 

def read_hosts_deny(): 
if os.path.exists(deny_file): 
with open(deny_file, 'rb') as f: 
d = pickle.load(f) 
 
return d 
else: 
return {} 
 
def write_hosts_deny(): 
with open(deny_file, 'wb') as f: 
pickle.dump(denied_hosts, f) 

def failed_login(): 
if not request.is_local: 
times_denied = 0 
if request.client in denied_hosts: 
times_denied = denied_hosts[request.client] + 1 
 
denied_hosts[request.client] = times_denied 
write_hosts_deny() 
 
time.sleep(5) 
 
def successful_login(): 
if not request.is_local: 
if request.client in denied_hosts: 
del denied_hosts[request.client] 
write_hosts_deny() 
 
 
 
# Then in /admin/controllers/default.py - index() # 
 

def index(): 
 Index handler  

send = request.vars.send 
if DEMO_MODE: 
session.authorized = True 
session.last_time = t0 
if not send: 
send = URL('site') 
if session.authorized: 
redirect(send) 
elif request.vars.password: 
if verify_password(request.vars.password): 
session.authorized = True 
### ADDED THE FOLLOWING LINE ### 
successful_login() 
 

if CHECK_VERSION: 
session.check_version = True 
else: 
session.check_version = False 

session.last_time = t0 
if isinstance(send, list):  # ## why does this happen? 
send = str(send[0]) 

redirect(send) 
else: 
response.flash = T('invalid password') 
 ADDED THE FOLLOWING LINE ### 
failed_login() 
# 

return dict(send=send)

This adds a 5 second delay to a failed login attempt, adds the IP address to 
the denied_hosts dictionary, along with the number of failed attempts. This 
dictionary is cached in RAM and is written to /admin/private/hosts.deny to 
maintain the list after a restart. Once a login is successful, the failed 
attempt counter is reset to zero.


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Ross Peoples
One quick change: In failed_login(), the line:

times_denied = 0

Should really be:

times_denied = 1


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread cjrh
That looks generally right, but you should invalidate the cache inside 
write_hosts_deny(), and I am fairly sure the *with* statement only arrived 
in 2.5.

[web2py] JSON-RPC Client

2011-07-12 Thread Ross Peoples
I know that web2py has a nice JSON-RPC Server built into it, but if I wanted 
two web2py applications to talk to each other, first would JSON-RPC be a 
good choice? And if so, does web2py have a built-in JSON-RPC client, or 
would I have to easy_install python-cjson and jsonrpclib?

[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Ross Peoples
Well, support for Python 2.4 was officially dropped with version 1.96.1, so 
I don't think 'with' will be a problem. You're right about the cache 
invalidation. Nice catch!

[web2py] Re: R: Re: R: Re: R: Re: Web Shell problem on Mozilla Firefox 5 and Internet Explorer 9 (PC with Vista)

2011-07-12 Thread Anthony
On Tuesday, July 12, 2011 2:14:07 AM UTC-4, Valter Foresto wrote: 

 I would like to use the console as a substitute for the Web Shell.

 
Sorry, I'm still not quite sure what you're trying to do. Can you give an 
example of a command you want to enter at the console, and what 
output/effect you expect? Is this something you have successfully done with 
the web shell but that does not work as expected with the console? 
Generally, the web shell and the console should provide the same 
functionality.
 

 Can I interact with my application using a web-browser when I use the 
 standard console ?

 
Yes, though they'll be running in separate Python processes. The browser 
will be sending regular http requests to your app via the Rocket server, and 
the console will simply give you a Python command line in which you can 
execute commands in the same context in which your app runs its controller 
functions (i.e., the console context will include all the web2py globals as 
well as objects defined in your models and, optionally, a controller that 
you specify). It should be the same in the web shell.
 
Anthony


[web2py] Re: break in template not working as expected

2011-07-12 Thread DenesL
Hi apple,

when processed by the template parser that creates:

for x in range(6):
response.write('\n', escape=False)
break
response.write('\n', escape=False)
response.write(hello there)
response.write('\n', escape=False)
pass
response.write(' \n\n', escape=False)

so hello there is outside the for loop.

The book says in chapter 6:

A code block starts with a line ending with a colon and ends with a
line beginning with pass. The keyword pass is not necessary when the
end of the block is obvious from the context.

In this case the second sentence applies, the code block ends after
'break'.
Note that 'return', 'continue', or 'raise' would also end a code
block.

Denes.


On Jul 12, 5:14 am, apple simo...@gmail.com wrote:
 Why does this show hello there on the page?

 {{for x in range(6):}}
         {{break}}
         {{=hello there}}
         {{pass}}


[web2py] Re: Powertable and virtual columns

2011-07-12 Thread DenesL
Hi Kenneth,

it really depend more on what you want the links to look like than
anything else.
You could have them one after the other:

return SPAN(A('Edit', _href=URL('receipt', 'create_receipt',
args=[self.t_receipt.id])),
XML('nbsp;'),
A('another link', _href=...))

or you could use DIVs, TABLE, UL/OL or CSS to have them stacked.

Denes.

On Jul 12, 9:47 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 Hello list,

 I m using Powertable to show a list of records. With virtual columns I
 create links to modify, copy and so on. To save space I d like to add
 more links into one column.

 I m using:
          @virtualsettings(label=T('Edit'))
          def edit(self):
              return A('Edit', _href=URL('receipt', 'create_receipt',
 args=[self.t_receipt.id]))

 to declare a new column, is it possible somehow to return 2 or more links?

 Kenneth


[web2py] Re: redirect to profile if first time login

2011-07-12 Thread Nicolas Palumbo
Any ideas on how to implement this?

On Wed, Jul 6, 2011 at 7:13 PM, Nicolas Palumbo napalu...@gmail.com wrote:

 I'm currently using ldap to auth with ldap_auth module of web2py.
 Currently if you are successful to login, are automatically redirected
 to index page.
 Which  happens the first time the user log in to the system as well.
 I'd like to detect if it is the first time for a user to log into the
 system and then redirect to profile edition.
 Any ideas?

 I was advised to to this:
 auth.settings.register_next = URL('defaul', 'user', args=['profile'])
 But is not working, I think is because users are not registering. They
 just log in.

 Thanks in advance,
 Nico



[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread cjrh
On Tuesday, July 12, 2011 4:14:42 PM UTC+2, Ross Peoples wrote:

 Well, support for Python 2.4 was officially dropped with version 1.96.1, 


I was not aware of that...although I do recall there was a discussion about 
doing so. 


[web2py] Re: web2py deployement on windows

2011-07-12 Thread mart
Hey,

I havent't seen any 'accept' button... do you have SSL enabled with
this config?

Thanks,
Mart :)

On Jul 12, 2:18 am, cjrh caleb.hatti...@gmail.com wrote:
 I think we can fill in defaults for IP and port, and only require a user to
 hit accept if they agree.  So that should make things even easier to just
 get started.  Also, the time that the splash logo is displayed is actually a
 setting, it isn't busy working during that delay.  I have been considering
 for a while putting a close button (think a small X somewhere) so that
 if you don't want to wait you can just go straight into the little config
 window.


[web2py] calendar error maximum call stack size

2011-07-12 Thread apple
I have a form which is loaded as a component using LOAD.

The master page includes web2py_ajax.html and each component also
loads this file. However this  prevents date fields from working in
the form. When I click on a date field the calendar appears as normal,
but when I select a date I get a javascript error in Chrome of
Uncaught range error maximum stack size exceeded and
Date.setFullYear is repeated a number of times. The error in Firefox
is too much recursion.

A workaround is to leave out web2py_ajax.html in the components. But
then I have to manually add in the bits that are needed such as
loading response files, and initializing flash messagesand I am
not sure what else is used by the components.






[web2py] calendar error maximum call stack size

2011-07-12 Thread apple
I have a form which is loaded as a component using LOAD.

The master page includes web2py_ajax.html and each component also
loads this file. However this  prevents date fields from working in
the form. When I click on a date field the calendar appears as normal,
but when I select a date I get a javascript error in Chrome of
Uncaught range error maximum stack size exceeded and
Date.setFullYear is repeated a number of times. The error in Firefox
is too much recursion.

A workaround is to leave out web2py_ajax.html in the components. But
then I have to manually add in the bits that are needed such as
loading response files, and initializing flash messagesand I am
not sure what else is used by the components.






Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread Bruno Rocha
Auth has an auth_event which stores login events for users.

You can make a count on event table to know if it is first time ligin.

http://zerp.ly/rochacbruno
Em 12/07/2011 11:57, Nicolas Palumbo napalu...@gmail.com escreveu:
 Any ideas on how to implement this?

 On Wed, Jul 6, 2011 at 7:13 PM, Nicolas Palumbo napalu...@gmail.com
wrote:

 I'm currently using ldap to auth with ldap_auth module of web2py.
 Currently if you are successful to login, are automatically redirected
 to index page.
 Which happens the first time the user log in to the system as well.
 I'd like to detect if it is the first time for a user to log into the
 system and then redirect to profile edition.
 Any ideas?

 I was advised to to this:
 auth.settings.register_next = URL('defaul', 'user', args=['profile'])
 But is not working, I think is because users are not registering. They
 just log in.

 Thanks in advance,
 Nico



[web2py] Re: calendar error maximum call stack size

2011-07-12 Thread Anthony
I don't think it's common to include web2py_ajax.html in components. 
response.files is intended to be a way to include CSS and JS files in the 
page's head/head -- however, your component won't be able to do that 
anyway since the main page has already loaded. Components should still be 
able to display flash messages on the page. Can you show an example of what 
you're trying to do in your component view that requires including 
web2py_ajax.html in it?
 
Anthony

On Tuesday, July 12, 2011 11:11:35 AM UTC-4, apple wrote:

 I have a form which is loaded as a component using LOAD. 

 The master page includes web2py_ajax.html and each component also 
 loads this file. However this  prevents date fields from working in 
 the form. When I click on a date field the calendar appears as normal, 
 but when I select a date I get a javascript error in Chrome of 
 Uncaught range error maximum stack size exceeded and 
 Date.setFullYear is repeated a number of times. The error in Firefox 
 is too much recursion. 

 A workaround is to leave out web2py_ajax.html in the components. But 
 then I have to manually add in the bits that are needed such as 
 loading response files, and initializing flash messagesand I am 
 not sure what else is used by the components. 






[web2py] how to POST a file without using a form?

2011-07-12 Thread weheh
How do I POST a file (to upload to my website) using a web2py app but
without user intervention via a form? For instance, let's say I have a
cron job that periodically looks for new jpegs in a folder and then
uploads them to my website automatically.

Extra karma points if you can also tell me how to catch the POST on
the server side. I've seen some old threads on the topic here but
can't quite figure it out, yet.


[web2py] Hosting web2p with mod_python on shared hosting

2011-07-12 Thread Tushar Chandra
Hi guys,
 I have been trying to  host web2py with mod_python on a shared
hosting env. (as My provider doesnt support mod_wsgi)

 So first i did what was given in the book -
http://web2py.com/book/default/chapter/11#Shared-Hosting-with-mod_python
 I was getting the KeyError: 'SCRIPT_URL' . So I replaced the
following line in web2py_modpython.py -

 req.subprocess_env['PATH_INFO'] =
req.subprocess_env['SCRIPT_URL']

   to
  req.subprocess_env['PATH_INFO'] =  '/var/clients/
client75/web285/web/'

Now i was getting invalid request error

Then i modified some lines  in modpythonhandler.py (as told by massimo
in a similar post) given below


if 'SCRIPT_NAME' in options:
# Override SCRIPT_NAME and PATH_INFO if requested.
env['SCRIPT_NAME'] = options['SCRIPT_NAME']
env['PATH_INFO'] = req.uri[len(options['SCRIPT_NAME']):]

  to

if 'SCRIPT_NAME' in options:
# Override SCRIPT_NAME and PATH_INFO if requested.
env['SCRIPT_NAME'] = options['SCRIPT_NAME']
req.uri = env['SCRIPT_NAME']
env['PATH_INFO'] = req.uri[len(options['SCRIPT_NAME']):]

m still getting the invalid request error

Web2py Version 1.97.1 , Apache/2.2.3 (CentOS)

Can ny1 pls tell me where m gng wrong? Is it a permission problem ?

Any help would be greatly appreciated


[web2py] Re: calendar error maximum call stack size

2011-07-12 Thread apple
I am using response.files to add my own css to override base.css. I
will now use my own include file instead.

The component is a form. When I submit the form then it reloads via
ajax. When web2py_ajax is loaded this shows the flash messages. The
flash messages do not show up unless explicitly called somewhere. Of
course I can always add the code calling up the flash messages myself
explicitly.

So overall this is not an unfixable problem. Just thought maybe there
was a way of avoiding the error in the first place with a tweak to the
calendar function.

On Jul 12, 4:29 pm, Anthony abasta...@gmail.com wrote:
 I don't think it's common to include web2py_ajax.html in components.
 response.files is intended to be a way to include CSS and JS files in the
 page's head/head -- however, your component won't be able to do that
 anyway since the main page has already loaded. Components should still be
 able to display flash messages on the page. Can you show an example of what
 you're trying to do in your component view that requires including
 web2py_ajax.html in it?

 Anthony







 On Tuesday, July 12, 2011 11:11:35 AM UTC-4, apple wrote:
  I have a form which is loaded as a component using LOAD.

  The master page includes web2py_ajax.html and each component also
  loads this file. However this  prevents date fields from working in
  the form. When I click on a date field the calendar appears as normal,
  but when I select a date I get a javascript error in Chrome of
  Uncaught range error maximum stack size exceeded and
  Date.setFullYear is repeated a number of times. The error in Firefox
  is too much recursion.

  A workaround is to leave out web2py_ajax.html in the components. But
  then I have to manually add in the bits that are needed such as
  loading response files, and initializing flash messagesand I am
  not sure what else is used by the components.


[web2py] inserting an empty list

2011-07-12 Thread mart
Just curious,

if an empty list s returned, can I not still insert it in a Field of
type list:string, then later test based on length ? (if len(myList)0:
blablabla)

thanks,
Mart :)


[web2py] Re: calendar error maximum call stack size

2011-07-12 Thread Anthony
On Tuesday, July 12, 2011 1:03:51 PM UTC-4, apple wrote: 

 I am using response.files to add my own css to override base.css. I 
 will now use my own include file instead.

 
CSS files are supposed to be included in the head of the HTML document, and 
the component can't do that since the component is loaded into a div within 
the page after the head has already been loaded. I think you can include CSS 
files within the body and it will work in many browsers, but technically, I 
don't think it is valid HTML.
 

 The component is a form. When I submit the form then it reloads via 
 ajax. When web2py_ajax is loaded this shows the flash messages. The 
 flash messages do not show up unless explicitly called somewhere. Of 
 course I can always add the code calling up the flash messages myself 
 explicitly.

 
When a component action sets response.flash, the message should be flashed 
when the component content is updated. Can you show some code where this is 
not working?
 
Anthony


[web2py] Re: inserting an empty list

2011-07-12 Thread pbreit
That should work. Did you get an error?

Re: [web2py] Multiple Domains, Subdomains, and Applications with SSL. Single web2py Instance on Apache

2011-07-12 Thread danto
I don't know what should be wrong, but I cannot map 2 apps to different
subdomains in the same domain, my routes.py is like the follow:

#!/usr/bin/python
#-*- coding: utf-8 -*-

routers = dict(
  BASE  = dict(
domains = {
'sub1.AAA.com' : 'app1',
'sub2.AAA.com' : 'app2',
}
)
  )


All works when there're just 1 app mapped (sub1-app1) but it stop working
when I add the second statement (sub2 - app2).
I restart/stop/start apache after every change on routes.py

I'm using webfaction, if that is useful to know.


[web2py] Get date from datetime with DAL

2011-07-12 Thread Angelo Compagnucci
Ello everybody!

I'm stuck whith a really simple thing, but the simpler are the worst!

I wrote this query:

rows = dbradius(dbradius.radacct.CalledStationId==hsname).select(
 count,
 dbradius.radacct.AcctStartTime.year(),
 dbradius.radacct.AcctStartTime.month(),
 dbradius.radacct.AcctStartTime.day(),
 groupby=entry_date)

Query works well, but I want a signle field for the date part, not the
three fields (year, month, day) I obtain.

There is a simple way to accomplish this?

Thank you!


[web2py] Validator for one of the following is required

2011-07-12 Thread Jim Steil

Hi

I have a contact table where I want to require that either the company 
name be entered, or that the first and last name be entered.  Is there a 
validator for that?  I can't seem to locate anything out of the box.


-Jim







[web2py] Re: Validator for one of the following is required

2011-07-12 Thread Anthony
Check out 
https://groups.google.com/forum/?fromgroups#!topic/web2py/brCjq5LjeVw.

On Tuesday, July 12, 2011 2:27:31 PM UTC-4, Jim S wrote:

 Hi 

 I have a contact table where I want to require that either the company 
 name be entered, or that the first and last name be entered.  Is there a 
 validator for that?  I can't seem to locate anything out of the box. 

  -Jim 



Re: [web2py] Re: Powertable and virtual columns

2011-07-12 Thread Roberto Perdomo
Do with links. I add a new column with links to edit and delete records.

The example:

 @virtualsettings(label=T('Acciones'))
def editar(self):
id = 1
link_editar = URL(request.application,'default',
'editar_tipo_nomina/')
link_icono_editar = IMG(_src=URL(r=request,c='static',
f='images/edit-icon24.png'), _alt='Editar')
link_eliminar= URL(r =request,f='eliminar_registro',
args=[self.tipo_nomina.id
,'eliminar','tipo_nomina'])
link_icono_eliminar= IMG(_src=URL(r=request,c='static',
 f='images/delete-icon24.png'),

 _alt='Eliminar',
_onclick=ajax('+link_eliminar+',[],'');
)
return (A(link_icono_editar, _href= link_editar + str(
self.tipo_nomina.id)), ' | ' ,A(link_icono_eliminar))

2011/7/12 DenesL denes1...@yahoo.ca

 Hi Kenneth,

 it really depend more on what you want the links to look like than
 anything else.
 You could have them one after the other:

 return SPAN(A('Edit', _href=URL('receipt', 'create_receipt',
 args=[self.t_receipt.id])),
XML('nbsp;'),
A('another link', _href=...))

 or you could use DIVs, TABLE, UL/OL or CSS to have them stacked.

 Denes.

 On Jul 12, 9:47 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
 wrote:
  Hello list,
 
  I m using Powertable to show a list of records. With virtual columns I
  create links to modify, copy and so on. To save space I d like to add
  more links into one column.
 
  I m using:
   @virtualsettings(label=T('Edit'))
   def edit(self):
   return A('Edit', _href=URL('receipt', 'create_receipt',
  args=[self.t_receipt.id]))
 
  to declare a new column, is it possible somehow to return 2 or more
 links?
 
  Kenneth



[web2py] R: Re: R: Re: R: Re: R: Re: Web Shell problem on Mozilla Firefox 5 and Internet Explorer 9 (PC with Vista)

2011-07-12 Thread Valter Foresto
Anthony,

*Can I interact with my application using a web-browser when I use the 
standard console ? ** ** **
Yes, though they'll be running in separate Python processes. The browser 
will be sending regular http requests to your app via the Rocket server, and 
the console will simply give you a Python command line in which you can 
execute commands in the same context in which your app runs its controller 
functions (i.e., the console context will include all the web2py globals as 
well as objects defined in your models and, optionally, a controller that 
you specify). It should be the same in the web shell.** *

The exact solution is described above:
(a) - run the app via Rocket server as usually
(b) - then use the console in same context of the app using :
@echo off
set /P app=Enter app/controller to run (controller optional): 
cd c:\path\to\web2py
python web2py.py -S %app% -M -N
 as you suggested before (... previously I missed point (a)). 

Just discovered and tested, full understanded now, 
Thank you very much, 
- Valter




Re: [web2py] Re: web2py deployement on windows

2011-07-12 Thread Caleb Hattingh
Sorry, I wasn't being specific. My idea was just to provide defaults with the 
startup of web2py to reduce a step. There is no literal accept button.

Sent from my iPad

On 12 Jul 2011, at 5:09 PM, mart msenecal...@gmail.com wrote:

 Hey,
 
 I havent't seen any 'accept' button... do you have SSL enabled with
 this config?
 
 Thanks,
 Mart :)
 
 On Jul 12, 2:18 am, cjrh caleb.hatti...@gmail.com wrote:
 I think we can fill in defaults for IP and port, and only require a user to
 hit accept if they agree.  So that should make things even easier to just
 get started.  Also, the time that the splash logo is displayed is actually a
 setting, it isn't busy working during that delay.  I have been considering
 for a while putting a close button (think a small X somewhere) so that
 if you don't want to wait you can just go straight into the little config
 window.


[web2py] Re: Get date from datetime with DAL

2011-07-12 Thread DenesL
Hi Angelo,

it depends on the type of field,

date fields can be accessed directly,
e.g. dbradius.radacct.AcctStartTime

datetime fields need .date():
dbradius.radacct.AcctStartTime.date()

Denes.

On Jul 12, 1:58 pm, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 Ello everybody!

 I'm stuck whith a really simple thing, but the simpler are the worst!

 I wrote this query:

 rows = dbradius(dbradius.radacct.CalledStationId==hsname).select(
                              count,
                              dbradius.radacct.AcctStartTime.year(),
                              dbradius.radacct.AcctStartTime.month(),
                              dbradius.radacct.AcctStartTime.day(),
                              groupby=entry_date)

 Query works well, but I want a signle field for the date part, not the
 three fields (year, month, day) I obtain.

 There is a simple way to accomplish this?

 Thank you!


[web2py] Re: web2py deployement on windows

2011-07-12 Thread mart
oh, i see.  yes, that makes sense :)

Mart :)

On Jul 12, 3:30 pm, Caleb Hattingh caleb.hatti...@gmail.com wrote:
 Sorry, I wasn't being specific. My idea was just to provide defaults with the 
 startup of web2py to reduce a step. There is no literal accept button.

 Sent from my iPad

 On 12 Jul 2011, at 5:09 PM, mart msenecal...@gmail.com wrote:







  Hey,

  I havent't seen any 'accept' button... do you have SSL enabled with
  this config?

  Thanks,
  Mart :)

  On Jul 12, 2:18 am, cjrh caleb.hatti...@gmail.com wrote:
  I think we can fill in defaults for IP and port, and only require a user to
  hit accept if they agree.  So that should make things even easier to just
  get started.  Also, the time that the splash logo is displayed is actually 
  a
  setting, it isn't busy working during that delay.  I have been considering
  for a while putting a close button (think a small X somewhere) so that
  if you don't want to wait you can just go straight into the little config
  window.


Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread Nicolas Palumbo
I solved it this way:

eventLogin = db(db.auth_event.user_id == auth.user.id).select()
if len(eventLogin) == 1:
session.flash= 'This is the first time you log in, please fill in
your profile'
redirect(URL('default','user/profile'))
#Obtain the row in audienceInstances table f

Thanks Bruno

On Tue, Jul 12, 2011 at 3:22 PM, Bruno Rocha rochacbr...@gmail.com wrote:

 Auth has an auth_event which stores login events for users.

 You can make a count on event table to know if it is first time ligin.

 http://zerp.ly/rochacbruno
 Em 12/07/2011 11:57, Nicolas Palumbo napalu...@gmail.com escreveu:

  Any ideas on how to implement this?
 
  On Wed, Jul 6, 2011 at 7:13 PM, Nicolas Palumbo napalu...@gmail.com
 wrote:
 
  I'm currently using ldap to auth with ldap_auth module of web2py.
  Currently if you are successful to login, are automatically redirected
  to index page.
  Which happens the first time the user log in to the system as well.
  I'd like to detect if it is the first time for a user to log into the
  system and then redirect to profile edition.
  Any ideas?
 
  I was advised to to this:
  auth.settings.register_next = URL('defaul', 'user', args=['profile'])
  But is not working, I think is because users are not registering. They
  just log in.
 
  Thanks in advance,
  Nico
 



[web2py] Re: inserting an empty list

2011-07-12 Thread mart
yes, If I set the field as Field('myField'), i get 'Field value does
not belong to the table' when doing .update(stuff=[]). if I set the
field as Field('myField','list:string'), i get the same error...

On Jul 12, 1:46 pm, pbreit pbreitenb...@gmail.com wrote:
 That should work. Did you get an error?


Re: [web2py] Re: Validator for one of the following is required

2011-07-12 Thread Jim Steil

thanks, I'll give that a run

On 7/12/2011 1:38 PM, Anthony wrote:
Check out 
https://groups.google.com/forum/?fromgroups#!topic/web2py/brCjq5LjeVw 
https://groups.google.com/forum/?fromgroups#%21topic/web2py/brCjq5LjeVw.


On Tuesday, July 12, 2011 2:27:31 PM UTC-4, Jim S wrote:

Hi

I have a contact table where I want to require that either the
company
name be entered, or that the first and last name be entered.  Is
there a
validator for that?  I can't seem to locate anything out of the box.

 -Jim



Re: [web2py] Re: Get date from datetime with DAL

2011-07-12 Thread Angelo Compagnucci
Thank you Denes,

What I'm trying to do is to select the date part from a datetime as
specified in the email subject, so the AcctStartTime field is a
datetime.

I'm navigating the epydoc documentation for dal.Field
http://www.web2py.com/examples/static/epydoc/web2py.gluon.dal.Field-class.html

and I cannot find reference for the date() method (only
year(),month(), day(), hour(), minutes(), seconds()) . Perhaps the
documentation is out of date.

I made several tries and in one of this I tryed also the date() method
in a query something like this:

rows = dbradius(dbradius.radacct.CalledStationId==hsname).select(
                              count,
                              dbradius.radacct.AcctStartTime.date(),
                              groupby=entry_date)

and it throws an exception. I can really make a mistake, so I'll try
your suggestion as soon as possible!

Thank you.

2011/7/12 DenesL denes1...@yahoo.ca:
 Hi Angelo,

 it depends on the type of field,

 date fields can be accessed directly,
 e.g. dbradius.radacct.AcctStartTime

 datetime fields need .date():
 dbradius.radacct.AcctStartTime.date()

 Denes.

 On Jul 12, 1:58 pm, Angelo Compagnucci angelo.compagnu...@gmail.com
 wrote:
 Ello everybody!

 I'm stuck whith a really simple thing, but the simpler are the worst!

 I wrote this query:

 rows = dbradius(dbradius.radacct.CalledStationId==hsname).select(
                              count,
                              dbradius.radacct.AcctStartTime.year(),
                              dbradius.radacct.AcctStartTime.month(),
                              dbradius.radacct.AcctStartTime.day(),
                              groupby=entry_date)

 Query works well, but I want a signle field for the date part, not the
 three fields (year, month, day) I obtain.

 There is a simple way to accomplish this?

 Thank you!


[web2py] display value in dropdown listbox

2011-07-12 Thread Jim Steil

Hi

I have the following tables/relations:

contact has a district that has a district manager

contact table has a district id
district table has an auth_user id

when editing a contact I want my dropdown to display my district number 
and the name of the manager.


How would I specify my validator on contact.districtId to display the 
name of the manager from the auth_user table?


I've tried:

district = db.define_table('district',
Field('districtId', 'id'),
Field('districtNumber', 'integer', required=True,
  unique=True, label='District Number'),
Field('name', length=50, required=True, unique=True),
Field('salesmanId', db.auth_user, required=True,
  label='District Manager'),
Field('includeInArAging', 'boolean', required=True,
  label='Include in A/R Aging'),
Field('regionNumber', 'integer', label='Region Number'))

district.districtNumber.requires = [IS_NOT_EMPTY(),
  IS_NOT_IN_DB(db, 'district.districtNumber')]
district.name.requires = [IS_NOT_EMPTY(),
  IS_NOT_IN_DB(db, 'district.name')]
district.salesmanId.requires = IS_IN_DB(db, db.auth_user,
'%(first_name)s %(last_name)s')

contact = db.define_table('contact',
Field('contactId', 'id'),
Field('company', length=50),
Field('title', length=20),
Field('firstName', length=25, label='First Name'),
Field('lastName', length=25, label='Last Name'),
Field('address1', length=50, label='Address'),
Field('address2', length=50, label=''),
Field('city', length=30),
Field('state', length=2),
Field('zipCode', length= 10, label='ZIP Code'),
Field('county', length=30),
Field('districtId', db.district, required=True, 
label='District'),

Field('phone1', length=25),
Field('phone2', length=25),
Field('phone3', length=25),
Field('mobilePhone', length=25, label='Mobile'),
Field('pager', length=25),
Field('homePhone', length=25, label='Home'),
Field('fax', length=25),
Field('emailAddress', length=10, label='Email'),
Field('notes', 'text'),
Field('priceListDelivery', length=10, label='Price Lists Via'))

contact.districtId.requires = IS_IN_DB(db, 'district.id', 
'%(salesmanId.first_name)s', zero=('select district'))


...but, I get an error on the salesmanId.first_name

I believe I have a fundamental misunderstanding of the ways in which 
this works.  Any pointers would be appreciated...


-Jim



[web2py] Web2py uses Django... on GAE

2011-07-12 Thread Carl
In looking at my log output on AppEngine I am getting this Warning:
You are using the default Django version (0.96). The default Django
version will change in an App Engine release in the near future.
Please call use_library() to explicitly select a Django version. For
more information see 
http://code.google.com/appengine/docs/python/tools/libraries.html#Django

Can anyone spread any light on this?


Re: [web2py] Re: Get date from datetime with DAL

2011-07-12 Thread pbreit
I believe datetime is a Python datetime.datetime object and gets validated 
by IS_DATETIME().

http://docs.python.org/library/datetime.html#datetime.datetime
http://web2py.com/book/default/chapter/07?search=IS_DATETIME


[web2py] Re: inserting an empty list

2011-07-12 Thread pbreit
Hmmm...might need to see the model, controller and database. Are you in 
development? Can you blow away the DB and start over? What does the full 
error trace look like? Are you updating any other fields? Are you using 
form.accepts?

Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread pbreit
There's also auth.settings.login_next

Perhaps you could set one or the other and then figure out some sort of 
check you can do to determine if it's a first login or not. A better check 
than first login might be if the profile is sufficiently filled out or not.


[web2py] Bookings with expiration date

2011-07-12 Thread Ialejandro
Hi! I'm currently building an app where I need accomplish this:

When a booking is made I specify the booking start date time and the
booking end date time. How could I check periodically when a booking
has ended (according to end date)??

For example:

db.define_table('building1_rooms'
Field('roomname'),
Field('owner'))

db.define_table('building1_bookings',
Field('requester'),
Field('startdate'),
Field('enddate'),
Field('validated','boolean'))

so what I need is this, a booking is created, an admin validates the
booking, room.owner takes building1_bookings.requester, and when
server date == enddate,  room.owner should be 'Free'


[web2py] Re: how to POST a file without using a form?

2011-07-12 Thread pbreit
Can you just grab the request.var?

def receive_posted_file()
f = request.vars.ifile
#process f


[web2py] Re: inserting an empty list

2011-07-12 Thread mart
good idea! yes, i will blow away the DB, try again and post the stack
trace. this using DAL in script (no web or forms).

thanks! :)

On Jul 12, 5:15 pm, pbreit pbreitenb...@gmail.com wrote:
 Hmmm...might need to see the model, controller and database. Are you in
 development? Can you blow away the DB and start over? What does the full
 error trace look like? Are you updating any other fields? Are you using
 form.accepts?


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread pbreit
I was not suggesting that we needed any immediate changes to trunk but I 
think it's good to be mindful of these types of things. The key is striking 
the right balance between usability, security and complexity.

[web2py] Re: default function of a controller

2011-07-12 Thread pbreit
How do you want it to work exactly? Can you show us an example? And what are 
your constraints? Do you not have control over your URLs?

Re: [web2py] Python 3 and the future of web2py

2011-07-12 Thread pbreit
I suspect 2.6 is going to be popular for some time since that's what's in 
the current Ubuntu LTS (10.04).

Re: [web2py] Re: Get date from datetime with DAL

2011-07-12 Thread Angelo Compagnucci
Sorry for being pedantic!

I made an empty application with only a table in the model defined as:

db.define_table('test',Field('data','datetime'))

and inserted some datetimes.

then I made a method in the controller:

def getdata():
rows = db(db.test).select()
return dict(rows=rows)

and it works.

It works also:

def getdata():
rows = db(db.test).select(db.test.data.year())
return dict(rows=rows)

but if I try:

def getdata():
rows = db(db.test).select(db.test.data.date())
return dict(rows=rows)

web2py throws an exception with the message:

File /home/angelo/DEV/web2py/applications/welcome/controllers/default.py,
line 13, in getdata
rows = db(db.test.ALL).select(db.test.data.data())
AttributeError: 'Field' object has no attribute 'date'

So what's wrong?

Thank you!

2011/7/12 pbreit pbreitenb...@gmail.com:
 I believe datetime is a Python datetime.datetime object and gets validated
 by IS_DATETIME().
 http://docs.python.org/library/datetime.html#datetime.datetime
 http://web2py.com/book/default/chapter/07?search=IS_DATETIME



[web2py] Two problems with LOAD; one may be a bug(?)

2011-07-12 Thread Cliff
Running Version 1.97.1 (2011-06-26 19:25:44)

First problem:
This is a snippet from a view file.  It works except that it displays
the output of the quals function.  Apparently it cannot find my
quals.load file and is using the generic load file in its place.

div id=tabs-3
{{=LOAD(c='users',f='quals.load',
extension='load', args=(request.args(0)),
ajax=True, target='tabs-3')}}
/div

As you can see, the controller is 'users.'  The 'quals.load' file is
in the 'views/users' directory, i.e. views/users/quals.load.

There's not much in quals.load.  Here's the whole thing:

h3Qualifications required by the plan./h3
pHello, world./p
{{=myreturn}}

myreturn is the output from the quals function in the users
controller.

Anybody got a clue as to what's happening?

Second problem:
In trying to find out if setting ajax to True was causing my first
problem, I stumbled over a second.  Setting 'ajax=False' or not
setting ajax at all causes an exception.  Could this be a bug?  If so,
please let me know where and how to report the thing.  It's totally
reproducible on my system.


Re: [web2py] Re: Powertable and virtual columns

2011-07-12 Thread Kenneth Lundström

Thank you both very much.

Now my Powertable looks much better.


Kenneth


Do with links. I add a new column with links to edit and delete records.

The example:

 @virtualsettings(label=T('Acciones'))
def editar(self):
id = 1
link_editar = URL(request.application,'default', 
'editar_tipo_nomina/')
link_icono_editar = IMG(_src=URL(r=request,c='static', 
f='images/edit-icon24.png'), _alt='Editar')

link_eliminar= URL(r =request,f='eliminar_registro',
args=[self.tipo_nomina.id 
http://self.tipo_nomina.id,'eliminar','tipo_nomina'])

link_icono_eliminar= IMG(_src=URL(r=request,c='static',
 f='images/delete-icon24.png'),
 _alt='Eliminar', 
_onclick=ajax('+link_eliminar+',[],'');

)
return (A(link_icono_editar, _href= link_editar + 
str(self.tipo_nomina.id http://self.tipo_nomina.id)), ' | ' 
,A(link_icono_eliminar))


2011/7/12 DenesL denes1...@yahoo.ca mailto:denes1...@yahoo.ca

Hi Kenneth,

it really depend more on what you want the links to look like than
anything else.
You could have them one after the other:

return SPAN(A('Edit', _href=URL('receipt', 'create_receipt',
args=[self.t_receipt.id http://self.t_receipt.id])),
   XML('nbsp;'),
   A('another link', _href=...))

or you could use DIVs, TABLE, UL/OL or CSS to have them stacked.

Denes.

On Jul 12, 9:47 am, Kenneth Lundström
kenneth.t.lundst...@gmail.com mailto:kenneth.t.lundst...@gmail.com
wrote:
 Hello list,

 I m using Powertable to show a list of records. With virtual
columns I
 create links to modify, copy and so on. To save space I d like
to add
 more links into one column.

 I m using:
  @virtualsettings(label=T('Edit'))
  def edit(self):
  return A('Edit', _href=URL('receipt', 'create_receipt',
 args=[self.t_receipt.id http://self.t_receipt.id]))

 to declare a new column, is it possible somehow to return 2 or
more links?

 Kenneth






[web2py] Re: inserting an empty list

2011-07-12 Thread mart
hum... same error. Here is the relevant stuff and the error is just
that ('Field value does not belong to the table')

thanks for the help!
Mart :)

the table...

db.define_table('local_history',
   Field('uuid',length=64,default=uuid.uuid4()),
   Field('input_name'),
   Field('input_path'),
   Field('dateTime'),
   Field('elemTree','blob'),
   Field('content','text'),
   Field('buildtype'),
   Field('truncateFields','boolean'),
   Field('nolocaluser','boolean'),
   Field('targets','list:string'))
db.commit()


and here is the relevant script...

if root.tag=='build':
tree=ElementTree()
try:
tree.parse(self.dataSource)
except Exception as errObj:
print('setDataSource: {0}'.format(errObj))
print('{0} will be parsed as SringIO')
dSource=StringIO(self.dataSource)
tree.parse(dSource,None)
buildSpecName=os.path.splitext(os.path.split(self.dataSource)[1])
[0]
iFile=open(self.dataSource,'r')
content=iFile.read()
iFile.close()

buildType=None
truncateFields=False
nolocaluser=False
targets=None
if self.cmdArgs:
if self.cmdArgs.buildtype:buildtype=\
 self.cmdArgs.buildtype
if self.cmdArgs.truncate:truncateFields=\
  self.cmdArgs.truncate
if self.cmdArgs.nolocaluser:nolocaluser=\
  self.cmdArgs.nolocaluser
if self.cmdArgs.targets:targets=\
  self.cmdArgs.targets

targetsList=[]
if targets is not None:
try:
targetlist=string.split(targets,',')
for targ in targetlist:
if targ:stargetsList.append(targ)
else:
 if targets:targetsList.append(targets)
except Exception as err:
print('can not establish target list\n{0}\
  '.format(err))

self.db.local_history.insert(input_name=buildSpecName\
,input_path='{0}'.format(self.dataSource)\
,value=self.dataSource\
,content=content\
,elemTree=cPickle.dumps(tree.getroot())\
,dateTime=datetime.datetime.now()\
,nolocaluser=nolocaluser\
,truncateFields=truncateFields\
,targets=targetsList)
self.db.commit()



in the script:

On Jul 12, 5:29 pm, mart msenecal...@gmail.com wrote:
 good idea! yes, i will blow away the DB, try again and post the stack
 trace. this using DAL in script (no web or forms).

 thanks! :)

 On Jul 12, 5:15 pm, pbreit pbreitenb...@gmail.com wrote:







  Hmmm...might need to see the model, controller and database. Are you in
  development? Can you blow away the DB and start over? What does the full
  error trace look like? Are you updating any other fields? Are you using
  form.accepts?


[web2py] Re: Two problems with LOAD; one may be a bug(?)

2011-07-12 Thread weheh
I couldn't understand your setup clearly: what's the name of the
controller file, the controller function, the views file ... Check
that these are what they are supposed to be. You say you got an
exception when ajax=False. What was the exception?

On Jul 12, 5:43 pm, Cliff cjk...@gmail.com wrote:
 Running Version 1.97.1 (2011-06-26 19:25:44)

 First problem:
 This is a snippet from a view file.  It works except that it displays
 the output of the quals function.  Apparently it cannot find my
 quals.load file and is using the generic load file in its place.

 div id=tabs-3
                     {{=LOAD(c='users',f='quals.load',
 extension='load', args=(request.args(0)),
                     ajax=True, target='tabs-3')}}
                 /div

 As you can see, the controller is 'users.'  The 'quals.load' file is
 in the 'views/users' directory, i.e. views/users/quals.load.

 There's not much in quals.load.  Here's the whole thing:

 h3Qualifications required by the plan./h3
 pHello, world./p
 {{=myreturn}}

 myreturn is the output from the quals function in the users
 controller.

 Anybody got a clue as to what's happening?

 Second problem:
 In trying to find out if setting ajax to True was causing my first
 problem, I stumbled over a second.  Setting 'ajax=False' or not
 setting ajax at all causes an exception.  Could this be a bug?  If so,
 please let me know where and how to report the thing.  It's totally
 reproducible on my system.


Re: [web2py] Bookings with expiration date

2011-07-12 Thread Kenneth Lundström
Who is doing the checking? If you want to send an email when a room is 
empty you need to run web2py from command prompt with cron to check if 
the end_date has gone.


When designing the database its maybe not a good idea to create a own 
tables for every buildning. Instead create a rooms table:


db.define_table('rooms'
Field('building'),
Field('roomname'),
Field('owner'))


Kenneth


Hi! I'm currently building an app where I need accomplish this:

When a booking is made I specify the booking start date time and the
booking end date time. How could I check periodically when a booking
has ended (according to end date)??

For example:

db.define_table('building1_rooms'
 Field('roomname'),
 Field('owner'))

db.define_table('building1_bookings',
 Field('requester'),
 Field('startdate'),
 Field('enddate'),
 Field('validated','boolean'))

so what I need is this, a booking is created, an admin validates the
booking, room.owner takes building1_bookings.requester, and when
server date == enddate,  room.owner should be 'Free'




[web2py] Re: display value in dropdown listbox

2011-07-12 Thread Massimo Di Pierro
You can do:

contact.districtId.requires = IS_IN_DB(db, 'district.id', '%
(salesmanId)s', zero=('select district'))
contact.districtId.represent = lambda id:
db.district(id).salesman.first_name

BUT mind that there will be two db queries every time you try
represent a districtID. I would not recommend it. I would cache the
salesman names or store then in table district.

On Jul 12, 3:37 pm, Jim Steil j...@qlf.com wrote:
 Hi

 I have the following tables/relations:

 contact has a district that has a district manager

 contact table has a district id
 district table has an auth_user id

 when editing a contact I want my dropdown to display my district number
 and the name of the manager.

 How would I specify my validator on contact.districtId to display the
 name of the manager from the auth_user table?

 I've tried:

 district = db.define_table('district',
              Field('districtId', 'id'),
              Field('districtNumber', 'integer', required=True,
                    unique=True, label='District Number'),
              Field('name', length=50, required=True, unique=True),
              Field('salesmanId', db.auth_user, required=True,
                    label='District Manager'),
              Field('includeInArAging', 'boolean', required=True,
                    label='Include in A/R Aging'),
              Field('regionNumber', 'integer', label='Region Number'))

 district.districtNumber.requires = [IS_NOT_EMPTY(),
                            IS_NOT_IN_DB(db, 'district.districtNumber')]
 district.name.requires = [IS_NOT_EMPTY(),
                            IS_NOT_IN_DB(db, 'district.name')]
 district.salesmanId.requires = IS_IN_DB(db, db.auth_user,
                                          '%(first_name)s %(last_name)s')

 contact = db.define_table('contact',
              Field('contactId', 'id'),
              Field('company', length=50),
              Field('title', length=20),
              Field('firstName', length=25, label='First Name'),
              Field('lastName', length=25, label='Last Name'),
              Field('address1', length=50, label='Address'),
              Field('address2', length=50, label=''),
              Field('city', length=30),
              Field('state', length=2),
              Field('zipCode', length= 10, label='ZIP Code'),
              Field('county', length=30),
              Field('districtId', db.district, required=True,
 label='District'),
              Field('phone1', length=25),
              Field('phone2', length=25),
              Field('phone3', length=25),
              Field('mobilePhone', length=25, label='Mobile'),
              Field('pager', length=25),
              Field('homePhone', length=25, label='Home'),
              Field('fax', length=25),
              Field('emailAddress', length=10, label='Email'),
              Field('notes', 'text'),
              Field('priceListDelivery', length=10, label='Price Lists Via'))

 contact.districtId.requires = IS_IN_DB(db, 'district.id',
 '%(salesmanId.first_name)s', zero=('select district'))

 ...but, I get an error on the salesmanId.first_name

 I believe I have a fundamental misunderstanding of the ways in which
 this works.  Any pointers would be appreciated...

      -Jim


[web2py] Re: Web2py uses Django... on GAE

2011-07-12 Thread Massimo Di Pierro
Definitively web2py does not uses Django.
GAE includes some Django libraries which we do not import but it is
possible that GAE does. Are you getting this error with dev_appserver
or in production?

Massimo


On Jul 12, 4:09 pm, Carl m...@carlroach.com wrote:
 In looking at my log output on AppEngine I am getting this Warning:
 You are using the default Django version (0.96). The default Django
 version will change in an App Engine release in the near future.
 Please call use_library() to explicitly select a Django version. For
 more information 
 seehttp://code.google.com/appengine/docs/python/tools/libraries.html#Django

 Can anyone spread any light on this?


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Massimo Di Pierro
we can make a delay default to 1 second and double it every failed
attempt.
we should add complexity. I would take a patch or add an issue in
google code.

On Jul 12, 8:01 am, cjrh caleb.hatti...@gmail.com wrote:
 I like the timeout/delay idea for a failed password, and I very much like
 the IP block after a number of failed attempts, but I am not too fond of a
 complexity requirement.  During development on my local machine (bound to
 localhost), my standard admin password is a.  I would have to have to deal
 with a complexity checker during development; and if we then say it will be
 enabled only for production but not dev, then we need more code and
 error-handling to manage the distinction, and it all becomes a lot of work.
   I think the safeguards that are currently in web2py are quite sufficient,
 and we can improve it a little bit more by penalizing brute force on the
 password, as pbreit pointed out is currently vulnerable.


Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread Nicolas Palumbo
that seems to be a better check. I think I'll do that. Checking the profile.
The ==1 seems not to be working when I passed the code to my test machine,
don't know why yet

On Tue, Jul 12, 2011 at 6:18 PM, pbreit pbreitenb...@gmail.com wrote:

 There's also auth.settings.login_next

 Perhaps you could set one or the other and then figure out some sort of
 check you can do to determine if it's a first login or not. A better check
 than first login might be if the profile is sufficiently filled out or not.



Re: [web2py] Bookings with expiration date

2011-07-12 Thread pbreit
If you want to run a job that periodically runs through all the rooms to set 
a status to free if necessary, I would suggest some sort of cron job. You 
can run it as frequently as once per minute. I do that to change product 
prices, expire abandoned orders, expire products, etc (pricetack.com).

The alternative is coming up with some business and query logic to piece 
together a room's availability on demand, perhaps based on the reserved 
time periods.

In your case, it seems like you will need to do #2 because I would think you 
would be checking available on a variety of different days for a variety of 
future dates.

It's an interesting programming challenge and one you should probably put 
some time into thinking about the various alternatives. There might even be 
some guidance in Google or something.


Re: [web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Kenneth Lundström
Please don´t make a mandotary complexity. On my dev site I use a simple 
password and it doesn´t bother me if somebody breaks in.


Delay sounds good.


Kenneth


we can make a delay default to 1 second and double it every failed
attempt.
we should add complexity. I would take a patch or add an issue in
google code.

On Jul 12, 8:01 am, cjrhcaleb.hatti...@gmail.com  wrote:

I like the timeout/delay idea for a failed password, and I very much like
the IP block after a number of failed attempts, but I am not too fond of a
complexity requirement.  During development on my local machine (bound to
localhost), my standard admin password is a.  I would have to have to deal
with a complexity checker during development; and if we then say it will be
enabled only for production but not dev, then we need more code and
error-handling to manage the distinction, and it all becomes a lot of work.
   I think the safeguards that are currently in web2py are quite sufficient,
and we can improve it a little bit more by penalizing brute force on the
password, as pbreit pointed out is currently vulnerable.




[web2py] Re: Many modal windows on one page

2011-07-12 Thread Kenneth Lundström
Is this impossible? Should I instead try something with a form in a DIV. 
I got some hints from Branko but could just not get it working. 
Javascript sounded a nice way but even their I only got close, not perfect.



Kenneth


Hello everybody,

I´m trying to create a page with a list of items. On every row a item 
is shown and every row has an Edit button. Instead of going to a new 
page to edit the record I´m trying to use modal window via AJAX to 
edit the record.


Mmodal plugin gets me quite close to a solution, but the problem is 
that mmodal is great for one link on the page. I´m going to need many 
links to the same form but different attributes. With mmodal I have to 
create a new different form for every row.


So far I have edited the example for mmdaol to look like this:
{{a=PluginMModal(title=T('Edit 
record'),content=form_edit,close='close',width=40,height=82)}}

{{=a}}
{{=a.link(T('Edit record'))}}

So instead of a text in content I´m sending a form that is created in 
the controller.


Ideal would be that in the a.link I could define what record I´d like 
to edit.


Any ideas how to achieve this?


Kenneth





Re: [web2py] Re: Many modal windows on one page

2011-07-12 Thread Bruno Rocha
I am using http://easyframework.com/demo_popup.php without problems.

2011/7/12 Kenneth Lundström kenneth.t.lundst...@gmail.com

 Is this impossible? Should I instead try something with a form in a DIV. I
 got some hints from Branko but could just not get it working. Javascript
 sounded a nice way but even their I only got close, not perfect.


 Kenneth


  Hello everybody,

 I惴 trying to create a page with a list of items. On every row a item is
 shown and every row has an Edit button. Instead of going to a new page to
 edit the record I惴 trying to use modal window via AJAX to edit the record.

 Mmodal plugin gets me quite close to a solution, but the problem is that
 mmodal is great for one link on the page. I惴 going to need many links to the
 same form but different attributes. With mmodal I have to create a new
 different form for every row.

 So far I have edited the example for mmdaol to look like this:
 {{a=PluginMModal(title=T('Edit record'),content=form_edit,**
 close='close',width=40,height=**82)}}
 {{=a}}
 {{=a.link(T('Edit record'))}}

 So instead of a text in content I惴 sending a form that is created in the
 controller.

 Ideal would be that in the a.link I could define what record I悲 like to
 edit.

 Any ideas how to achieve this?


 Kenneth





-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: Two problems with LOAD; one may be a bug(?)

2011-07-12 Thread pbreit
Maybe try:
 {{=LOAD('users', 'quals.load', args=(request.args(0)), ajax=True)}}

The c= and f= are fine but not necessary. The extra .load is definitely 
unnecessary and may have been causing the problem. You can insert .load in 
either place but not both.

If that works, try adding back the target. Also, as you have done, try it 
with ajax=False.


[web2py] Re: inserting an empty list

2011-07-12 Thread pbreit
Hmmm..hard to say. Do you have an error trace?

Shouldn't matter but I would conside these changes:

targets=None
to
targets=[]

if targets is not None:
to
if targets:

if targets:targetsList.append(targets)
to
targetsList.append(targets)

If you are doing if targ:stargetsList.append(targ), isn't if targ always 
going to be True? And the else clause will never run?

Are the db.commits necessary?


[web2py] Re: Web2py uses Django... on GAE

2011-07-12 Thread howesc
this warning popped up recently when GAE started bundling 2 versions of 
django.  by default it still uses the old version of django in case you 
needed it for your project.  there is a flag somewhere that can be set to 
tell GAE to use the new version of django.  i assume we could find and set 
the flag even though we use none of the django code.


[web2py] Re: Two problems with LOAD; one may be a bug(?)

2011-07-12 Thread Anthony

On Tuesday, July 12, 2011 5:43:55 PM UTC-4, Cliff wrote: 

 Running Version 1.97.1 (2011-06-26 19:25:44) 

 First problem: 
 This is a snippet from a view file.  It works except that it displays 
 the output of the quals function.  Apparently it cannot find my 
 quals.load file and is using the generic load file in its place. 

 div id=tabs-3 
 {{=LOAD(c='users',f='quals.load', 
 extension='load', args=(request.args(0)), 
 ajax=True, target='tabs-3')}} 
 /div

 
Note, LOAD itself returns a div, and the id of that div is whatever you 
specify as the 'target' argument (if you don't specify 'target', it creates 
a random id). So, you're actually nesting the LOAD div inside another div, 
and they both have the same id (i.e., tabs-3). So, either don't put the 
LOAD inside a div, or make sure you give it a different id. Also, you don't 
need to specify the '.load' in your f argument if you also specify the 
extension argument (in that case, I think it will end up ignoring the 
extension argument).
 

 Second problem: 
 In trying to find out if setting ajax to True was causing my first 
 problem, I stumbled over a second.  Setting 'ajax=False' or not 
 setting ajax at all causes an exception.  Could this be a bug?  If so, 
 please let me know where and how to report the thing.  It's totally 
 reproducible on my system.

 
There is currently a bug with ajax=False where response.generic_patterns is 
not getting passed to the component, so generic views are not working with 
non-ajax components at the moment. If you're getting an invalid view error, 
that could be the problem.
 
Anthony


[web2py] Re: web2py deployement on windows

2011-07-12 Thread Brian M
You can run web2py as a windows service too 
http://web2py.com/book/default/chapter/11#Start-as-Windows-Service  

~Brian


Re: [web2py] Re: Paid project: Open source GAE blobstore upload feature in web2py

2011-07-12 Thread howesc
my comments are at the bottom of the slice that Martin linked above.  I'm 
using (perhaps a variant of) the code on www.elizabethscanvas.org.  i don't 
know of a good way to package it with web2py, but feel free to try the slice 
and let me know where it is broken.

for starmakerstudios.com i need to integrate that blob upload for profile 
pictures, so i'll be in that code again in the next week or two, let's get 
it cleaned up and shared!!

Anand, if we get this working for you feel free to just contribute your cash 
to web2py. ;)

christian


[web2py] Re: Admin security: https vs localhost

2011-07-12 Thread Anthony
If you add a complexity requirement, make it for remote connections only.
 
Anthony

On Tuesday, July 12, 2011 6:32:48 PM UTC-4, Massimo Di Pierro wrote:

 we can make a delay default to 1 second and double it every failed 
 attempt. 
 we should add complexity. I would take a patch or add an issue in 
 google code. 

 On Jul 12, 8:01 am, cjrh caleb.h...@gmail.com wrote: 
  I like the timeout/delay idea for a failed password, and I very much like 

  the IP block after a number of failed attempts, but I am not too fond of 
 a 
  complexity requirement.  During development on my local machine (bound to 

  localhost), my standard admin password is a.  I would have to have to 
 deal 
  with a complexity checker during development; and if we then say it will 
 be 
  enabled only for production but not dev, then we need more code and 
  error-handling to manage the distinction, and it all becomes a lot of 
 work. 
I think the safeguards that are currently in web2py are quite 
 sufficient, 
  and we can improve it a little bit more by penalizing brute force on the 
  password, as pbreit pointed out is currently vulnerable.



[web2py] Re: web2py deployement on windows

2011-07-12 Thread mart
so many options! this is great too! kind of makes me wonder where my
head has been this last year ;)

Thanks everyone! I will try the as a service option as well.

Mart :)


On Jul 12, 8:50 pm, Brian M bmere...@gmail.com wrote:
 You can run web2py as a windows service 
 toohttp://web2py.com/book/default/chapter/11#Start-as-Windows-Service 

 ~Brian


[web2py] Re: inserting an empty list

2011-07-12 Thread mart
I'll try your suggestions. The db.commits() are necessary because DAL
is used outside of the web2py web context (using dal in script).

if targ: ... hum... yeah, you're right its a useless thing (just
removed that now, thanks :))

There is no other stack trace, but I suppose I can remove the try/
except bloc and let python spit out what it really thinks. Ok, yes,
I'll do that too.

Thanks for the input!
Mart :)

On Jul 12, 8:09 pm, pbreit pbreitenb...@gmail.com wrote:
 Hmmm..hard to say. Do you have an error trace?

 Shouldn't matter but I would conside these changes:

 targets=None
 to
 targets=[]

 if targets is not None:
 to
 if targets:

 if targets:targetsList.append(targets)
 to
 targetsList.append(targets)

 If you are doing if targ:stargetsList.append(targ), isn't if targ always
 going to be True? And the else clause will never run?

 Are the db.commits necessary?


[web2py] Re: Many modal windows on one page

2011-07-12 Thread niknok
Bruno, would you be so kind and post a slice or short example on the
use of easyframework+w2p?

On Jul 13, 7:58 am, Bruno Rocha rochacbr...@gmail.com wrote:
 I am usinghttp://easyframework.com/demo_popup.phpwithout problems.

 2011/7/12 Kenneth Lundström kenneth.t.lundst...@gmail.com









  Is this impossible? Should I instead try something with a form in a DIV. I
  got some hints from Branko but could just not get it working. Javascript
  sounded a nice way but even their I only got close, not perfect.

  Kenneth

   Hello everybody,

  I惴 trying to create a page with a list of items. On every row a item is
  shown and every row has an Edit button. Instead of going to a new page to
  edit the record I惴 trying to use modal window via AJAX to edit the record.

  Mmodal plugin gets me quite close to a solution, but the problem is that
  mmodal is great for one link on the page. I惴 going to need many links to 
  the
  same form but different attributes. With mmodal I have to create a new
  different form for every row.

  So far I have edited the example for mmdaol to look like this:
  {{a=PluginMModal(title=T('Edit record'),content=form_edit,**
  close='close',width=40,height=**82)}}
  {{=a}}
  {{=a.link(T('Edit record'))}}

  So instead of a text in content I惴 sending a form that is created in the
  controller.

  Ideal would be that in the a.link I could define what record I悲 like to
  edit.

  Any ideas how to achieve this?

  Kenneth

 --

 --
 Bruno Rocha
 [ About me:http://zerp.ly/rochacbruno]
 [ Aprenda a programar:http://CursoDePython.com.br]
 [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
 [ Consultoria em desenvolvimento web:http://www.blouweb.com]


[web2py] Re: inserting an empty list

2011-07-12 Thread mart
Mystery solved!

the culprit was none other than my deficient brain!

the error 'Field value does not belong to the table' should have been
taken more literally... there is no Field called 'value' yet i was
trying to update a field called value :(

self.db.local_history.insert(input_name=buildSpecName\
,input_path='{0}'.format(self.dataSource)\
,value=self.dataSource\
,.


sorry for the trouble! and thanks for the help!

Mart :)

On Jul 12, 9:35 pm, mart msenecal...@gmail.com wrote:
 I'll try your suggestions. The db.commits() are necessary because DAL
 is used outside of the web2py web context (using dal in script).

 if targ: ... hum... yeah, you're right its a useless thing (just
 removed that now, thanks :))

 There is no other stack trace, but I suppose I can remove the try/
 except bloc and let python spit out what it really thinks. Ok, yes,
 I'll do that too.

 Thanks for the input!
 Mart :)

 On Jul 12, 8:09 pm, pbreit pbreitenb...@gmail.com wrote:







  Hmmm..hard to say. Do you have an error trace?

  Shouldn't matter but I would conside these changes:

  targets=None
  to
  targets=[]

  if targets is not None:
  to
  if targets:

  if targets:targetsList.append(targets)
  to
  targetsList.append(targets)

  If you are doing if targ:stargetsList.append(targ), isn't if targ always
  going to be True? And the else clause will never run?

  Are the db.commits necessary?


[web2py] Re: Many modal windows on one page

2011-07-12 Thread pbreit
Easyframework is kind of neat but the licensing is ridiculous for this sort 
of thing.

Re: [web2py] Re: Many modal windows on one page

2011-07-12 Thread Bruno Rocha
On Wed, Jul 13, 2011 at 12:12 AM, pbreit pbreitenb...@gmail.com wrote:

 Easyframework is kind of neat but the licensing is ridiculous for this sort
 of thing.


It is really Easy to use, and I do not worry about spending only $49 to get
it working on my apps.

I will try to create a demo app, but it is really easy.

Example:

1. Include easy.js in your static/js and put a script in to your page
2. Initialize it with js/main.js or just the widgets you need i.e :
$.easy.popup()
3. create elements and set the css class to popup' a href=#loginform
class=popupOpen login form in a popup/a

Thats easy...

I will try yo turn easy demo page in to a web2py app..

* You can use it for free if running a non-profit website, You can use it
for development, for commercial apps/sites you have to pay $49


Re: [web2py] Re: Many modal windows on one page

2011-07-12 Thread pbreit
The price is only part of the problem. That and the limited license almost 
guarantee minimal usage and I would never feel comfortable recommending it. 
Stuff like that benefits from lots of users. I think the developer has made 
a major mistake.

  1   2   >