Thanks for the solution. Sorry for the slow reply - I wanted to try it out,
but haven't since I had already fixed the problem by explicitly converting
from strings to datetimes, and moved on with my work.
One question: Why isn't the use of PARSE_COLTYPES the default behavior? It
seems
Ah yes! Thank you, Greg!
I come from the Matlab world and am not very experienced with object
oriented program, but I was suspecting it was something like that.
I think I found a true bug in the way datetime objects work in db queries,
though -- I will post under a new subject heading.
Doing database queries on datetime.datetime fields seems broken. Here's an
example:
I have a database with a table 'transEntry' which includes a 'datetime'
field:
db.define_table('itemEntry',
* Field('dateTime','datetime'),*
Field('upc', 'string'),
Field('description',
Cut and paste, sorry!
Wanted to rename broken_search for clarity and failed. Late night...
—« sent from my Droid tablet »—
On Aug 19, 2011 12:12 AM, Jose C houdinihoun...@gmail.com wrote:
In [183]: broken_search = db( (db.transEntry.dateTime ex)
(db.transEntry.storeNumber==store_num)
Apologies again - all typos. The first query was built by typing (no longer
in my ipython history), and full of mistakes.
The proper way to do this is to create a simple sample that everyone can
replicate (too tired late last night to do so..).
Will do so now, constrained by work
I think you are right, Anthony!
In the original query, first_search (or gar with), first_search[270] is the
first entry on the new date!!!
(and also first_search[269] is the same entry as broken_query[269], so the
search results are the same up to that point).
I will still make a simple
Here is a simple example ... but it seems to behave properly:
test datetime in db queries
import sys
sys.path.append(/mnt/data1/web2py)
from gluon import *
import datetime
import random
db = DAL('sqlite://debug_datetime.sqlite',
Ciao Massimo,
I wasn't clear in my post : It's not a web app, I'm using DAL as part of a
data analysis program I am writing. I debug with ipython, but the
script/programs I write can be called like : python
test_412_determine_open_or_closed_lane.py , which outputs results to a
file.
I think I have figured it out, with the help of a python expert at work.
I am using sqlite3, which internally stores data as strings.
When creating my real database (not the toy example), I read raw date and
time data as an isoformat string, and relied on DAL/web2py to convert. But
perhaps in
Let
my_DT = datetime.datetime( 2011, 08, 16)
db.define_table( 'entry', Field('DT' = 'datetime' ) )
(and add data records to the database ...)
In a db query, this works:
db( db.entry.DT my_DT).select()
but this does not:
db( my_DT db.entry.DT).select()
producing error : can't
There was an article that compares
CubicWeb, Django, Pyramid, Web.py, Web2py, and Zope 2and it gave web2py the
highest rankings!
link:
http://www.infoworld.com/d/application-development/pillars-python-six-python-web-frameworks-compared-169442
(Sorry if this is considered spam on the list --
(oops, sorry, didn't see already posted).
Yes ... too many :(
Here's a 'simple' one:
The database table definition, which I use as a form for input:
db.define_table('scorecard',
Field('offense1', db.player, requires=IS_IN_DB( db, 'player.id',
'%(name)s', zero=T('choose one')) ),
Field('defense1', db.player,
Thanks, Massimo!
Even if I grab 1000 at a time (which is definitely better to do!!),
I still have to wait for minutes before I get rows back!
However, I have found that this is 'fast' :
n = db.table.count() # not sure if that's the syntax, but somehow find out
how many records in table
for
Thanks, Vineet! Lot's of good info there!
I don't have actual code yet, because I couldn't even get the db queries to
work in a reasonable amount of time.
The little code I showed in my initial post already runs slow ( my DB
records are db.itemEntry, not db.table ...).
The slowness (so
you want with just CSS?
Anthony
On Saturday, July 23, 2011 2:33:54 AM UTC-4, Luis Goncalves wrote:
Yes ... too many :(
Here's a 'simple' one:
The database table definition, which I use as a form for input:
db.define_table('scorecard',
Field('offense1', db.player, requires
Thanks, Anthony!
I still haven't figured it out completely (mostly because I don't know very
much about CSS and someone else is dealing with that part of the project).
Thanks!
Luis.
I am trying to use web2py's DAL for a project that is not a webapp.
I have a database with about 8M entries, and I want to process the data.
Suppose I create a query that returns a lot of results:
extreme case example:
q = db.table.id0
How do I iterate through all the results of a large
I've been away to conferences and somehow missed these replies!
Thank you all for the replies!
I send the same content, so in principle CSS definitions should be able to
restyle satisfactorily.
I actually found two books that seem quite helpful: by Jonathan Stark,
published by O'Reilly,
Tables are hard to control in CSS, is there a way to have SQLFORM use divs
or lists instead?
I have seen many(!) posts about redefining SQLFORM and making it more
flexible, but I'm not sure if any conclusion has been reached.
Thanks,
Luis.
Hello Anthony, and others!
I implemented your very first suggestion, code in a model, outside of a
function, as you (and pbreit) suggested. It worked fine! It's been very
hectic (meetings/travel) and I haven't had a chance to reply until now.
Thanks for your help (everybody!) !!! Luis.
I didn't.
But by doing the authentication manually (that is, in an interactive shell),
I was able to connect to linked in. I realized that I wouldn't be able to
get the information that I wanted though (email address - never provided by
linkedin!), so I gave up.
But the web2py linked-in
Hello Everyone!
Is there a simple/efficient/secure way to temporarily redirect all requests
to a specific page?
(all requests except for those that define a few actions that are permitted
at that point in time)
The context:
- When user logs in, he needs to choose the version of the website
more thoughts:
could I do something like:
- define a shared global variable session.version
- = -1 initially, signifying no choice made
- ? use a callback that gets executed *before *the controller that
responds to the request
- if session.version -1:
let the
Awesome!!! Thanks!!! I will try it out!!!
Luis.
Hello!!
As part of the login process, I need the user to make a choice (select one
of the multiple versions of the site he has access to, for example), before
being redirected to whatever _login_next is.
Is it possible for a login_onaccept callback to present a view with a
form?
My
Done!
Thank you!!!
Luis.
On Thu, Jul 7, 2011 at 6:24 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
Please open a ticket in google code. If this is a web2py but will fix
asap.
On Jul 6, 11:24 pm, Luis Goncalves lgoncal...@gmail.com wrote:
In fact, just to make sure there wasn't
I found the answer searching through the group posts:
form.element(_name='email')['_readonly']=True
although this doesn't seem to be documented in the manual,
and even looking through the gluon directory (and grepping for _readonly )
didn't reveal anything.
Would this have been
For the record, here's how I was able to implement an by invitation only
registration form.
Assuming that the user received an email with a link of form
http://.../default/user/register?token=sfaasdfasfa,
and assuming I have defined a db table 'registrant' associating a token with
a name
Hello!!!
I have a form where an organizer can input a list of comma-separated email
address, so that each person receives an invitation to register on the
website (you can only register for the site if you have an invitation).
Is there an easy way to get the if form.accepts() to use
Excellent! Works perfectly!! Also a great lesson in how to extend the set
of web2py form validators!
Thank you, Bruno!!! Obrigado!!!
Luis.
Good point!
Unfortunately, I am not expert enough to understand how to do this in my
case, because I am using the form=auth.register().
Wouldn't I have to do what you suggest inside Auth.register ?
(for an explanation of why I am doing this, see:
Both with Massimo's
auth.settings.table_user.email.default = registrant.email
auth.settings.table_user.email.writable=False
form=auth.register()
and with your
db[auth.settings.table_user_name].email.writable=False
Actually, I still want email verification to happen (because someone else
may stumble upon the link and register with a password unknown to the real
user).
Nevertheless, I disabled registration verification, and now I get an error
deep within gloun/tools.py
Error occurs after entering
I still get the same error:
File /home/ubuntu/web2py/gluon/tools.py, line 1683, in register
user = self.db(table_user[username] == form.vars[username]).select().first()
KeyError: 'email'
I don't know if it makes a difference or not, but I'm using emails for login
(not a username) -- as
your db.registrant has an email?
On Jul 6, 10:04 pm, Luis Goncalves lgoncal...@gmail.com wrote:
I still get the same error:
File /home/ubuntu/web2py/gluon/tools.py, line 1683, in register
user = self.db(table_user[username] ==
form.vars[username]).select().first()
KeyError: 'email'
I
auth.settings.registration_requires_verification = False
return dict(form=auth())
L.
On Wed, Jul 6, 2011 at 8:35 PM, Luis Goncalves lgoncal...@gmail.com wrote:
Yes, when I click on the invite and go to the website I get the
registration form filled out with email (and name (excluded from my
shortened example
This doesn't seem to work with auth() forms:
form = auth.register()
form.vars.email = 'l...@vision.caltech.edu'
return dict(form=form)
doesn't show the predefined value for 'email' in a view that renders
{{=form}}
Does anybody know why?
Thanks!!
Luis.
AM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
Can you explain the logic? Are you trying to override whatever emails
is typed in by the user on registration?
On Jul 5, 12:08 pm, Luis Goncalves lgoncal...@gmail.com wrote:
This doesn't seem to work with auth() forms:
form
, auth.register() creates the form and
calls form.accepts. Instead, you can pre-populate by manipulating the form
DOM directly:
form.element(_name='email').update(_value='lu...@vision.caltech.edu')
Anthony
On Tuesday, July 5, 2011 1:08:31 PM UTC-4, Luis Goncalves wrote:
This doesn't seem to work
One more question:
How do I make the pre-populated elements of the form appear read-only (so
that they cannot be altered)?
I've tried in the view:
{{=form.custom.begin}}
divFirst name: {{=predef.fname}}/div
divLast name: {{=predef.lname}}/div
divEmail: {{=predef.email}}/div
Hello!
It seems to me that the behavior of checkboxes is different and non-standard
from the rest of input types, causing one to handle it as a special case
(when trying to automate input field processing).
In my application, an admin can create profile forms through a friendly
interface.
Hello Richard!
I looked at this, but wasn't sure how it could help -- what I need is a way
for a (non-technical) admin to create profile forms with arbitrary fields
(through a friendly web interface), and then users to be able to view and
edit their (run-time reconfigurable) profiles.
At any
table...
Finally it maybe possible with component now to load a arbitrary number of
fields inputs for a given table and with jQuery submit the differents forms
as one I would investigate in that direction too...
Good luck
Richard
On Mon, Jul 4, 2011 at 7:17 PM, Luis Goncalves
Hello!
The website I am developing will be invitation only:
- a user gets an email invitation to register with a link to the site (with
an identifying token in the link)
- the link takes the user to the website, where he can register
- to register, he need only define the password, since the
Thanks, pbreit, for the link! Long thread!!!
I read it all, but am still unclear how to force registration with a
pre-defined name and email
(I'll have DB entries such that each unique invite token is associated with
a pre-defined name and email).
I was hoping to do something like this:
def
That's a great idea, David!
I think I need to know, then:
- how to programmatically create registered users
- how to programmatically send them the 'reset password' link.
Ideally, the person that can invite users will have a simple webpage form
where they can input names and email addresses,
Hello!
How do I make a database table where the fields are defined by another
table?
For example, suppose some users of my system are event organizers, and they
can define what fields would belong in a person's profile.
Then, attendees of that event have to fill out a profile with those
Hello!
I need to customize my views so that they look good on a computer screen and
on a smart phone.
One way to do so, It think, is to have separate layout definitions and then
do something like:
{{if session.platform == 'mobile':}}
{{extend 'mobile-layout.html}}
{{else:}}
{{extend
Thanks for the quick reply, Anthony!!!
We may try the following : break layout.html into header and footer
(everything before and after body), then instead of using {{extend}} we
will use conditional {{include}} statements at the top and bottom of each
view. That will still give us
Hello!
I've been trying to use login via linkedin using the
contrib/login_methods/linkedin_account.py module.
Off the bat, I got the error : AttributeError: 'module' object has no
attribute 'LinkedIn'
(this is the same problem Kuba mentioned on nov 12 2010)
the reason is that
An update (getting closer, but still problems):
It seems there are a couple more errors in linkedin_account.py:
There is an extraneous command which must have been left over from sample
code:
profile = self.api.GetProfile(profile).public_url =
http://www.linkedin.com/in/ozgurv;
One more clue:
In the infinite loop, every loop through the linkedin grant access
(/oas/oauth/authorize) page has a new oauth_token, such as
https://www.linkedin.com/uas/oauth/authorize?oauth_token=f9eef16e-4f45-4f5e-aa5f-82ab18ad3a16
L.
Thanks, Massimo!
I thought that (redundantly)
routes_onerror = [
(r'sandbox_luis/*', r'/sandbox_luis/static/fail.html')
(r'*/*', r'/sandbox_luis/static/fail.html')
]
would catch all errors, but
https://domain.net/sandbox_luis/default/contact_person?
results in
Bad
This seems like a silly question, but I can't figure it out!
Trying to follow the example in the book to use openAuth2.0 and facebook's
graphAPI, we need to
from facebook import GraphAPI
as suggested, I installed pyfacebook
first via apt-cache search pyfacebook -- apt-get install
Awesome! Thank you! Will check it out!
Luis.
I've been trying to use OAuth2.0 and the facebook module to allow a user to
login to my site, and then use the facebook API to obtain info about them
via GraphAPI.
The web2py manual (8.1.6, subsection OAuth2.0 and facebook) describes two
methods, the first to login to your own app, the second
Is there an easy/straightforward way to implement a fail whale for a
web2py website?
I've noticed strange errors (some sort of timeout) when uploading files
(running on Amazon ec2), and of course, the site is in beta and bad things
may happen.
I'd like to have a graceful landing page the
I have Janrain working as a login method (thanks to the instructions in the
web2py manual, and sample code in default app).
I'd like to include the profile photo (that, say, facebook provides via
janrain) as part of the user profile.
I had my own function based on the sample code at the
Ciao Massimo!
Is it now available somewhere for download? It will be very useful!!!
Thanks,
Luis.
Excellent! Thank you both!
Before I had [file | (cbox) delete ]
requires=IS_IMAGE()
got rid of the delete and checkbox, but now I am still left with
[file]
(a link to download the file)
Might have to do server-side DOM parsing to get rid of that ...
Thanks!!!
Luis.
Thanks for the reply!
I tried that, but it didn't do what I want.
I wasn't very clear in explaining what I'm trying to do (sorry about that!).
I have a file upload field in my SQLFORM, and it has a choose file
button, and right next to it a [file| (chk-box) delete] element.. I want
to get
Hi Richard!
I'm displaying the form to the user for them to update it. There are
several fields in the form, and one of them is an image ('upload' field).
I just don't want to display the delete file checkbox for the image, so
that the user can't delete the image. They can upload a new
Is there a way to avoid showing the delete file checkbox in a form?
Thanks,
Luis.
Haven't been able to find any examples showing how to define a default image
for an upload field of a db table (headshot for a person's profile).
Is it possible? Does anyone know how?
thanks!
Luis.
Forgot to mention, I need this on google appengine.
My hack so far:
- create a new DB table, 'default images'
db.define_table('default_images',
Field('name', requires=IS_NOT_EMPTY()),
Field('uploaded','upload', requires=IS_NOT_EMPTY()))
- create a admin-only
Perfect! Thanks!!
These tidbit examples are invaluable!
As I learn web2py, I am taking notes of where I get stuck, in order to
eventually provide suggestions for improving the doc/manual from the
novice's eyes (once you already know everything, it isn't as obvious what's
missing). The
Hello Annet!
Your example helps a lot! I'm not yet familiar enough with web2py/
python to realize that I could just extend the empty user() controller
(and I don't think I came across an example in the web2py book or the
online examples).
Since I already had my own my_profile() controller, what
/appliances/default/show/10
--
Bruno Rocha
[ About me:http://zerp.ly/rochacbruno]
On Sun, May 29, 2011 at 2:09 AM, Luis Goncalves lgoncal...@gmail.comwrote:
Hello!
I'm building an application where logged-in users can send messages to
each other (the message gets sent
want to it working.
2011/5/29 Luis Goncalves lgoncal...@gmail.com
Hello!
I'm building an application where logged-in users can send messages to
each other (the message gets sent to the recipient's normal email, and
they use a link to come back to the site and reply).
I want a page
Hello All!
There is a database action that I want to do in several views.
Right now, I have it implemented as a link in each view as
a href=db_action?id={{=item_id}}Toggle Status/a
How do I get my db_action() controller to return back to the page
with the link that called it?
Is there
Hello!
I have a controller, my_control(), that can be called by itself, or with
two arguments , ../default/my_control/AAA or .../BBB
In the associated view, my_control.html, I have some href links that call a
new controller:
a href=compute_value?id={{=stock.id}}Compute
I figured it out ...
.. use the powerful URL() helper function!
sorry for the 'spam'
L.
Thanks!
I was confused, but the URL doc makes it clear that there are applications,
controllers, functions, arguments, and variables.
Thx,
L.
Perfect!!! Thank you!!!
Luis.
On May 27, 10:28 pm, pbreit pbreitenb...@gmail.com wrote:
I think you have to search/replace:
{{=XML(str(message_body).replace('\n', 'br'), sanitize=True)}}
I'm not sure if str() is always necessary or if sanitize needs to be True.
Hello!
I'm building an application where logged-in users can send messages to
each other (the message gets sent to the recipient's normal email, and
they use a link to come back to the site and reply).
I want a page (ie, controller, view, (and model)) that allows the user
to see the messages
Hello Everyone!
How do I modify default/user/profile to use my own form (where the profile
contains more information)?
I think it should be easy, but I haven't found any info or an example yet.
Thanks in advance!!!
Luis.
I have a string variable, message_body, which is multiline (has
newlines or \n characters).
How do I get it to display properly in an HTML view?
simply using {{=message_body}} displays the text all on the same
line, ignoring the carriage returns.
{{=TEXTAREA(message_body)}} displays
I'm running on linux (Ubuntu 10.04.2, or my old debian system).
I start from a shell with python dev_appserver.py ../web2py/
On my old debian system, this pops up a little window where I type in
my admin password and hit the start server button.
On the new Ubuntu system it tells me I don't
Good idea to copy the files to the debian system and try to see them
there!
Also good idea to look at the applications/admin/errors directly! I
will try!
Yes, I've got source code 1.95.1 (stable) for web2py
GAE (when you run uploaded from google) uses python 2.5.2.
Likewise, web2py recommends
background, and am just now
switching to python. The learning curve is not too steep,
and I can already see the power of python!!!
I'm building a website, and GAE + web2py seemed
like the best choice. web2py is awesome!!!)
On May 25, 11:57 pm, Luis Goncalves lgoncal...@gmail.com wrote:
Good idea
Thank you, Arbie!
For a while I was using a Windows (windose) machine with the Google
App Engine Launcher, and so had no console to see.
Then I switched to linux, and didn't even notice that the console
echoed the error output!
Curiously, with an old debian machine with python 2.5.2, admin and
In reply to your and ron_m's messages:
On Ubuntu 10.04.02 with python 2.6.5,
When I have a simple error in my python controller (say, return
dict(ans=ans) , where ans hasn't been defined),
if I run python web2py.py :
I first get the web-browser error:
Internal error
83 matches
Mail list logo