I often use the web2py helpers to build my tables on the fly. I've always
thought it was strange that my THEAD() helper seemed to prefer wrapping its
components inside a TD element instead of a TH. I mean, why not a TH? We
already know its in a header.
Playing around, I found this pattern
I'll definitely keep that code in mind. It looks really useful for
barely-structured or unstructured data!
My text files are so highly structures that I'm using struct to parse the
text. The fields are all on fixed boundaries. It's just that the text
format chosen represents fields in
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#format--Record-representation
Not entirely sure if the record representation technique will work, but
maybe you could use the lambda to call a named function that renders the
divs for each thumbnail.
I think the css
Are you sure that's a feature and not a bug?
On Wednesday, September 10, 2014 3:32:24 AM UTC-4, Joe Barnhart wrote:
I often use the web2py helpers to build my tables on the fly. I've always
thought it was strange that my THEAD() helper seemed to prefer wrapping its
components inside a TD
Does anyone have a clue why this code
def make_option(row):
return OPTION(row[1], _value=row[0])
q = '''
SELECT id, name
FROM products
WHERE
is_active = 'T' AND
tenant_link = {} AND
You need to argument expand (using *) the result of the map in the first
case.
myselect = SELECT(
OPTION('Choose'),
*map(make_option, rows),
_id='container_selector',
_name='container_selector',
)
--
Resources:
- http://web2py.com
-
I tried the following such that when the user clicks on Submit button from
the Grid edit form, it would open the dialog. - But it just opens the
dialog and in actual doesn't updates the db or performs the other checks.
grid.element(_type='submit')['_onclick']='%s;return false' %dialog1.show()
too much code will kill you. Start simple, and go from there onwards.
def test():
url = 'http://creativity103.com/collections/Landscape/golf_course.jpg'
r = requests.get(url)
if r.status_code == 200:
newheaders = r.headers
meaningful = ['Content-Length',
BTW, log somewhere db._timings before returning and try to replay the query
in mysql to see what's going on.
On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote:
Well that's true, but web2py automatically calls db.commit for you after
running the controller. That would
you can't cross-reference a field between two separate
databases..there's no way to create a foreign key between different
databases.
On Wednesday, September 10, 2014 1:36:23 AM UTC+2, José Eloy wrote:
Hi!
I'm developing an web2py application that use an external SQL Server
I dunno. If a bug turns out to be useful, does that make it a feature?
On Wednesday, September 10, 2014 12:54:11 AM UTC-7, Cliff Kachinske wrote:
Are you sure that's a feature and not a bug?
On Wednesday, September 10, 2014 3:32:24 AM UTC-4, Joe Barnhart wrote:
I often use the web2py
there is no or little way to make python talk with java. I assume though
that the java app can return some data in form of an api call. from there
on it's just a matter of coding in web2py the api call.
On Tuesday, September 9, 2014 10:43:10 AM UTC+2, Gurpreet Singh Anand wrote:
I am a Python
by default in form submission any input with the attribute hidden is not
sent. That's HTML 101. If you need something that is not visible to the
user but the browser still needs to submit, use css, not the attribute
hidden.
On Tuesday, September 9, 2014 12:50:48 PM UTC+2, trr wrote:
I have
The INT implementation is correct as it follows the python convention for
ranges. For float frankly it's better that way as float comparison is a
freaking headache.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Hi, I tried this apporach:
http://blog.lifeeth.in/2012/02/uwsgi-mule-magic-and-web2py-scheduler.html
My config.xml for uwsgi:
uwsgi
uidweb2py/uid
gidweb2py/gid
virtualenv/home/user/webapps/web2py/env/virtualenv
http:25903/http
pythonpath/home/user/webapps/web2py/web2py/pythonpath
I don't think webfaction allows you to have a resident process active
beside the web-serving one.
On Wednesday, September 10, 2014 12:35:25 PM UTC+2, Zbigniew Pomianowski
wrote:
Hi, I tried this apporach:
http://blog.lifeeth.in/2012/02/uwsgi-mule-magic-and-web2py-scheduler.html
My
Can you show an example of where it wraps the items in a TD? I think that
would only happen if you explicitly put items into TR's, in which case the
TR will control what wraps its components.
Also, you don't need a tuple -- can just be a list inside a list:
print THEAD([['a', 'b']])
Thank Cliff and Massimo for your help.
I have finally make in very similar fission:
I have 2 divs,
controller1 with static form with id=1 that inserted in div1,
another controller2 that triggers by w2p_component (ajax) and generates
form with id=2 and inserted to div2 but all input fields of this
You need to rewrite request.vars into form.vars in form validation.
I use following (based on maybe web2py doc or maybe some article in this
conference).
I have javascript YUI2 autocomplete in client (on customer field), which
will set hidden customer_id field.
In JavaScript I use jQuery
Can you show your code? What does the DOM look like right before
submitting? Using the browser tools, what data get sent with the post
request?
On Tuesday, September 9, 2014 6:50:48 AM UTC-4, trr wrote:
I have a hidden input in form. I set the hidden value in client by java
script. But I
trr said the value is *not* in request.vars.
On Wednesday, September 10, 2014 8:32:51 AM UTC-4, Mirek Zvolský wrote:
You need to rewrite request.vars into form.vars in form validation.
I use following (based on maybe web2py doc or maybe some article in this
conference).
I have javascript
maybe it works without this line too:
Field('customer_id', readable=False, writable=False),
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received
Maybe(?) he creates hidden field in the html, instead to define it in the
SQLFORM():
form = SQLFORM.factory(
Field('customer', label=Select customer),
hidden=dict(customer_id='')
)
Dne středa, 10. září 2014 14:34:44 UTC+2 Anthony napsal(a):
trr said the value is *not*
I think I can have a resident process. When I make a simple loop script it
is executed by mule. It is strange to me I need to pass -p 25903 to have
active worker that performs the queued tasks.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
-
Il 10/09/14 11:18, Niphlod ha scritto:
too much code will kill you. Start simple, and go from there onwards.
thank you so mutch!
M.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
Dear all,
There is an error when use SQLFORM.grid in LOAD function.
This are steps to reproduce the problem?
*Step 0*
# in models/db.py
db.define_table('product',
Field('code', length = '50', notnull = True, unique = True),
Field('name', notnull = True),
)
*Step
I have no idea how to fix this error. I used this same code earlier in
google app engine and it worked just fine. Now I moved my app to ubuntu +
apache + postgresql and got this error:
Error ticket for viikko Ticket ID
130.234.160.35.2014-09-10.08-14-09.e20b10b7-72bd-4f79-9618-948387ca1cf0
Thanks Niphlod. I changed from _type='hidden' to _class='hidden. But still
it is not in request.vars. In controller I do
INPUT(_id='txtNoOfRows',_class='hidden',_value=len(l)),
On Tuesday, September 9, 2014 4:20:48 PM UTC+5:30, trr wrote:
I have a hidden input in form. I set the hidden value
LoveWeb2py wrote is it possible to add a scroll bar to the top so I don't
have to scroll all the way to the bottom to scroll to the right?
I also have the same question.
Thanks,
Antonis
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
-
Sorry for the trouble here:
I pushed this to trunk:
def rss(feed):
if not 'entries' in feed and 'items' in feed:
feed['entries'] = feed['items']
def safestr(obj, key, default=''):
return str(obj[key]).encode('utf-8', 'replace') if key in obj else
default
now =
Python does as below. SELECT does otherwise. I was curious as to why.
In [1]: foo = ['bar', 'baz', 'bazzle']
In [2]: def func(str):
...: return 'fu{}'.format(str)
...:
In [3]: map (func, foo)
Out[3]: ['fubar', 'fubaz', 'fubazzle']
In [4]: def printem(lis):
...: for l in
On Wednesday, September 10, 2014 7:26:12 AM UTC-4, trr wrote:
Thanks Niphlod. I changed from _type='hidden' to _class='hidden. But still
it is not in request.vars. In controller I do
INPUT(_id='txtNoOfRows',_class='hidden',_value=len(l)),
No need for that -- _type='hidden' should work
On Wednesday, September 10, 2014 8:45:36 AM UTC-4, Mirek Zvolský wrote:
Maybe(?) he creates hidden field in the html, instead to define it in the
SQLFORM():
form = SQLFORM.factory(
Field('customer', label=Select customer),
hidden=dict(customer_id='')
)
Doesn't
Are you saying you don't want each record in an HTML table row but instead
want to display each record as a card? There's no built-in way to do that,
but you can hack the returned grid object and replace the HTML table with
your own DOM:
def my_custom_grid_layout(rows):
[code to produce
SELECT is not expected to behave like your printem() function, which merely
takes a list. SELECT can either take a list, or it can take a set of
positional arguments. In your case, however, you have passed it one
positional argument followed by a second positional argument that happens
to be a
If I was to enable HTML in posts using:
{{=XML(post.body)}}
and disable registration entirely using:
auth.settings.actions_disabled.append('register')
Would that be enough to remove security concerns about injections from the
outside?
And as a side note, thank you guys for this great
if started, scheduler doesn't quit itself. Where are you needing to pass
-p 25903 ?
BTW: in that script, importing gluon.widget is superflous.
On Wednesday, September 10, 2014 3:00:11 PM UTC+2, Zbigniew Pomianowski
wrote:
I think I can have a resident process. When I make a simple loop
you are the only one choosing how much security would matter to you and
your app. In this case, you are permitting anything to be injected in your
page. If you trust your users at that level, please do. As soon as you get
an annoyed user, your site will be screwed but hey, you were the trusting
Depends on how secure the posting permissions are. Disabling registration
isn't necessary, as long as registered users can't post. Of course, if you
don't need registration (presumably you don't if you're disabling it), then
you should disable it anyway.
Anthony
On Wednesday, September 10,
Note, you can also do XML(..., sanitize=True) and also specified
permitted_tags and allowed_attributes to make it a little safer.
Anthony
On Wednesday, September 10, 2014 12:46:20 PM UTC-4, Anthony wrote:
Depends on how secure the posting permissions are. Disabling registration
isn't
Thanks Niphlod for the answer.
I didn't know that was not possible to reference tables from a database to
another. The solution to this is to move the required tables to the
external database.
Regards.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
-
Got it.
That's why I need to unpack the list.
I even knew that. (palm to forehead)
On Wednesday, September 10, 2014 11:23:41 AM UTC-4, Anthony wrote:
SELECT is not expected to behave like your printem() function, which
merely takes a list. SELECT can either take a list, or it can take a set
I've moved back to the Bay Area and was surprised to find there is no
web2py meetup group. Massimo, how did your web2py meetup in San Fran go
many moons ago? How was the interest level? Bay Area web2py community, are
you interested in a web2py meetup? Or should we continue to piggy-back the
I agree. I come often to SF. I will be there again at the end of November.
Let me know what I can do to help.
On Wednesday, 10 September 2014 14:12:14 UTC-5, weheh wrote:
I've moved back to the Bay Area and was surprised to find there is no
web2py meetup group. Massimo, how did your web2py
I'm down in the Half Moon Bay area, spend some time in the valley. Meetup'd
be fun.
On Wednesday, September 10, 2014 1:08:58 PM UTC-7, Massimo Di Pierro wrote:
I agree. I come often to SF. I will be there again at the end of November.
Let me know what I can do to help.
On Wednesday, 10
I've been looking into using classes to store values, just like for
example session does in web2py. I found on stack overflow that it might not
be pythonic, it is not recommended by some experienced programmers.
Not sure what that means. Can you share specific arguments made against
Yes, thank you, I'm disabling registration for a personal blog in which I'm
the only one who posts, and from the looks of it the answers suggest this
is enough.
On Wednesday, September 10, 2014 7:46:20 PM UTC+3, Anthony wrote:
Depends on how secure the posting permissions are. Disabling
I was looking for something that does exactly this, using a dict with
class syntax, and I could only find solutions that would set class
attributes. The only problem I stumbled upon would be to use the key from
as it is a python keyword.
With Storage, you can use from as a key, but not
Hey,
the php documentation has user comments with examples of how to use
different functions. This is a great complement to their documentation.
With web2py I have stumbled upon many things in these forums that I have
not seen in the documentation. I'm not sure how often you update it, since
I
It's not embedded with the main documentation, but for user contributed
content, we do have http://www.web2pyslices.com/home.
Anthony
On Wednesday, September 10, 2014 5:55:36 PM UTC-4, Robin Manoli wrote:
Hey,
the php documentation has user comments with examples of how to use
different
Thanks Anthony, indeed I will have to evaluate the tradeoff of speed for
complexity. I don't think that our site will have the amount of traffic
that this would be a problem but its always good to know good practices!
A friend suggested to use
db((db.task.id == 5) (db.task.ref_to_job ==
db((db.task.id == 5) (db.task.ref_to_job == db.job.id)
(db.job.ref_to_project == db.project.id) (db.project.owner ==
auth.user_id))
I tried it and it works, but I am not sure how different it is from the
one Leonel suggested. How does this work?
The above does a join, so it gets
Actually, no. Wrapping a list inside a list does NOT work. In that case,
the inside list is all joined together as a single string. Only a tuple
inside a list works. I tried everything, only the tuple in the list worked.
On Wednesday, September 10, 2014 5:04:54 AM UTC-7, Anthony wrote:
Well, the code I pasted definitely works -- copied the code and output
directly from the shell (also tried in an app). Can you show your code
where a tuple worked but a list did not? Also, please show the code that
wraps the cells in TD's instead of TH's.
Anthony
On Wednesday, September 10,
Thanks guys!
Anthony's hint help me out to solve this.
If somebody is interested on how I did it, here's the code:
def search():
users = SQLFORM.grid(db.users,
fields=[db.users.id, db.users.facebook_id, db.users.first_name, db.
users.last_name, db.users.birthday],
I have a fresh copy of w2p 2.9.9 and I have tried the
request_reset_password function.
It generates an email with a text like
http://127.0.0.1:8000/testupdate/default/user/reset_password/14104...
It's the right auth_user.reset_password_key
That's ok, but if I try this link I get an error message
I'm in! I live in Santa Clara, or as most people know it ... Silicon
Valley!
On Wednesday, September 10, 2014 12:12:14 PM UTC-7, weheh wrote:
I've moved back to the Bay Area and was surprised to find there is no
web2py meetup group. Massimo, how did your web2py meetup in San Fran go
many
57 matches
Mail list logo