Re: [web2py] Re: preferred solution for parsing {xht,ht,x}ml

2013-01-07 Thread Vasile Ermicioi
lxml, beautifulsoup --

[web2py] web2py and crawlers

2013-01-07 Thread sasogeek
i was wondering, if i wrote a crawler in modules to populate a database table, how would the crawler run? as in how to run that script? --

[web2py] Re: Uploading images

2013-01-07 Thread Wonton
Hello Alan, Thank you very much for your answer. Finally, based on your note ( ... renames uploaded files (to prevent directory traversal attacks) ...), in the difficulty of the changes, and taking into account that the rename is not very necessary in fact, I've decided not to change the name

Re: [web2py] Changed date to datetime. Now I get: invalid literal for int() with base 10:

2013-01-07 Thread Massimo Di Pierro
When you delete a sqlite database, make sure you delete all the associated .table files too. On Sunday, 6 January 2013 20:45:34 UTC-6, HittingSmoke wrote: Yep, SQLITE. But I completely wiped the database from the disk in web2py/applications/application/databases and let web2py write a

[web2py] Re: web2py and crawlers

2013-01-07 Thread Massimo Di Pierro
You can try: python web2py.py -S yourapp -M -R yourscript.py use -h for command line options On Monday, 7 January 2013 04:25:13 UTC-6, sasogeek wrote: i was wondering, if i wrote a crawler in models to populate a database table, how would the crawler run? as in how to run that script? --

[web2py] How do I get last n rows from table?

2013-01-07 Thread Hans Cr
I want my controller to return the last ('updated') n rows given de definition below given a certain 'gid' and 'sid'. Can anyone help me? Thanks a lot in advance! Hans db.define_table('value', Field('gid', 'string'), Field('sid', 'string'), Field('value', 'integer',

[web2py] subforms / formsets / form cloning imprementation

2013-01-07 Thread Henrique Pantarotto
Hello everybody! I'm quite new to Python and web2py, but I consumed all of web2py's wonderful documentation at the last few days and I'm quite amazed at this wonderful framework. But there's a feature that I need that I couldn't find a way to easily implement it. The application that I'm

[web2py] Re: web2py and crawlers

2013-01-07 Thread sasogeek
the app is on an online server... http://sasogeek.pythonanywhere.com/newup/ will it work with that still work? On Monday, 7 January 2013 11:15:51 UTC, Massimo Di Pierro wrote: You can try: python web2py.py -S yourapp -M -R yourscript.py use -h for command line options On Monday, 7 January

[web2py] Re: How do I get last n rows from table?

2013-01-07 Thread Niphlod
tb = db.value db((tb.gid == 'something') (tb.sid == 'othersomething')).select(orderby=~ tb.updated, limitby=(0, 10)) will give you the last 10 On Monday, January 7, 2013 10:20:06 AM UTC+1, Hans Cr wrote: I want my controller to return the last ('updated') n rows given de definition below

[web2py] Re: How do I get last n rows from table?

2013-01-07 Thread Hans Cr
Thanks! Works great! On Monday, January 7, 2013 12:33:19 PM UTC+1, Niphlod wrote: tb = db.value db((tb.gid == 'something') (tb.sid == 'othersomething')).select(orderby =~tb.updated, limitby=(0, 10)) will give you the last 10 On Monday, January 7, 2013 10:20:06 AM UTC+1, Hans Cr wrote:

[web2py] How do I get last row for each type from table?

2013-01-07 Thread Hans Cr
I want my controller to return the last ('updated') row for each 'sid', given a specified 'gid'. 'sid' is multiple times in the table, but I want to have the last row. Can anyone help me? Thanks a lot in advance! Hans db.define_table('value', Field('gid', 'string'), Field('sid',

[web2py] self join on postgres

2013-01-07 Thread Paolo valleri
Hi all, I've problems on defining self join queries on postgres, the query, works on sqlite, is defined as follows: start = db.record.with_alias('start') end = db.record.with_alias('end') query = ((start.station_id == 11) (end.station_id == 12)) rows = db( query

[web2py] Re: cpdb errors

2013-01-07 Thread mart
hum... you should just remove the quotes around the connection strings (options -y and -Y) since they are already strings when passed in. Otherwise, argparse will do this: ' sqlite://storage.sqlite' and then dal will not be able to open the DB. So, no quotes, should fix the problem. -y

Re: [web2py] How do I get last row for each type from table?

2013-01-07 Thread Vinicius Assef
Try using groupby clause. On Mon, Jan 7, 2013 at 10:19 AM, Hans Cr cloudsens...@gmail.com wrote: I want my controller to return the last ('updated') row for each 'sid', given a specified 'gid'. 'sid' is multiple times in the table, but I want to have the last row. Can anyone help me? Thanks

[web2py] Re: self join on postgres

2013-01-07 Thread Niphlod
did you try changing start and end as aliases ? while start on postgresql isn't reserved ( but is a reserved keyword for t-sql:2003 and t-sql:1999), end is reserved even for postgresql. On Monday, January 7, 2013 1:21:27 PM UTC+1, Paolo valleri wrote: Hi all, I've problems on defining self

Re: [web2py] Re: plugin to drag and drop upload of a file

2013-01-07 Thread Vincenzo Ampolo
On 01/07/2013 02:39 AM, Alan Etkin wrote: Are the .css files added to the ajax response? In that case, I doubt they will affect the document. I'd add the css files to response.files in the plugin model instead, so they are appended to the app layout. | # models/plugin_file_upload.py

Re: [web2py] How do I get last row for each type from table?

2013-01-07 Thread Hans Cr
Thanks, indeed this was the way. This works great: tb = db.value values = db((tb.gid == 'something')).select(groupby=tb.value, orderby=~tb.updated) On Monday, January 7, 2013 1:28:39 PM UTC+1, viniciusban wrote: Try using groupby clause. On Mon, Jan 7, 2013 at 10:19 AM, Hans Cr

[web2py] registration issue with web2py 2.3.2

2013-01-07 Thread weheh
After upgrading to 2.3.2, my custom user registration breaks. I have auth_user password encoded as follows in my user's model: ... Field('password', 'password', readable=False, label=T('Password'), requires=[CRYPT(), IS_LENGTH(512, 6)], ), ... During

[web2py] Re: How to parse quoted '%20' RESTfully to web2py?

2013-01-07 Thread Leonel Câmara
Isn't the problem that you're using args instead of request.args? I think web2py unquotes stuff for you, but you can always use urllib.unquote if necessary, you don't need the htmlparser it's just a url. Segunda-feira, 7 de Janeiro de 2013 5:04:47 UTC, Alec Taylor escreveu: I can't figure

[web2py] PosOnlineStore example:, views/default/invioce.html wrongly named. (Fix)

2013-01-07 Thread web2py
In the PosOnlineStore example appliance, views/default/invioce.html should be called views/default/invoice.h All that's required to fix this is to rename the file to the correct name. This doesn't make much difference to the appearance of the application: instead of an invoice that looks like:

Re: [web2py] Re: plugin to drag and drop upload of a file

2013-01-07 Thread Derek
I don't see it as an issue, but I'd consider merging those css files into one, to reduce the amount of requests that need to be made. The fact that they are CSS files and not hard-coded means that you aren't mixing them up, since they are still separate. On Monday, January 7, 2013 6:23:22 AM

Re: [web2py] Changed date to datetime. Now I get: invalid literal for int() with base 10:

2013-01-07 Thread HittingSmoke
I cleared all files from the applications/databases directory to let it start new. That includes all .table files and storage.sqlite. What I did was: Changed date to datetime Shut down server rm applications/databases/* Start server Load app and leave a comment Reload comments page Somehow the

Re: [web2py] Re: How to parse quoted '%20' RESTfully to web2py?

2013-01-07 Thread Alec Taylor
Oh oops, reduced my stuff to a test-case and forgot to fill in the rest of my definition. Meant to be `def get_group(*args, **kwargs)` On Tue, Jan 8, 2013 at 3:12 AM, Leonel Câmara leonelcam...@gmail.comwrote: Isn't the problem that you're using args instead of request.args? I think web2py

Re: [web2py] Re: How to parse quoted '%20' RESTfully to web2py?

2013-01-07 Thread Alec Taylor
On Tue, Jan 8, 2013 at 4:25 AM, Alec Taylor alec.tayl...@gmail.com wrote: Oh oops, reduced my stuff to a test-case and forgot to fill in the rest of my definition. Meant to be `def get_group(*args, **kwargs)` [have it in a @request.restful()) On Tue, Jan 8, 2013 at 3:12 AM, Leonel

[web2py] Help integrating s-cubism uploadify widget

2013-01-07 Thread Andrew Evans
Hi I am having problems integrating this plugin http://dev.s-cubism.com/plugin_uploadify_widget in to my form. In my Models.py I have from plugin_uploadify_widget import ( uploadify_widget, IS_UPLOADIFY_IMAGE, IS_UPLOADIFY_FILENAME, IS_UPLOADIFY_LENGTH ) db.define_table('video',

[web2py] Re: self join on postgres

2013-01-07 Thread Paolo valleri
Hi Niphlod, yes it solved the problem. Now I have an other problem, I need to make a self left join, but limited to 1 match only. Namely, I've just need to make the join only for the first matching row. I've tried something like: rows = db( query

[web2py] Is it possible to define how a field is rendered in the DB model?

2013-01-07 Thread HittingSmoke
For instance, could I set a field in the database to be always rendered in Markmin or sanitized HTML instead of in the view every time it's queried? --

[web2py] Re: web2py and crawlers

2013-01-07 Thread webpypy
is it possible to use scrapy http://scrapy.org/? On Monday, January 7, 2013 2:20:16 PM UTC+3, sasogeek wrote: the app is on an online server... http://sasogeek.pythonanywhere.com/newup/ will that still work? On Monday, 7 January 2013 11:15:51 UTC, Massimo Di Pierro wrote: You can try:

[web2py] Re: Is it possible to define how a field is rendered in the DB model?

2013-01-07 Thread Niphlod
using field.represent or the new filter_out parameter ... docs aren't there but it's pretty simple. db.define_table('test3', Field('testfield', filter_out=lambda value : value.upper) ) However, for computations like MARKMIN, the better choice is to store in another computed field the

[web2py] Associate a db record with a logged in user

2013-01-07 Thread Dave Cenker
This seems so elementary, but I can't seem to find out how to do it in the book or googling the group ... I have several users defined and when that user is logged in and is creating a db record that is specific to that user, I want it to be automatically assigned to him/her. For example,

[web2py] Re: self join on postgres

2013-01-07 Thread Niphlod
If I understand correctly the problem it's a matter of using windowing functions, that are not available on all db engines and far too complicated to expose a consistent api by the DAL. Picking out the first match only doesn't quite explain what you need in detail (maybe it can be worked out

[web2py] Re: Is it possible to define how a field is rendered in the DB model?

2013-01-07 Thread szimszon
Hi! What is a difference between represent and filter_out? Tnx. --

Re: [web2py] Changed date to datetime. Now I get: invalid literal for int() with base 10:

2013-01-07 Thread Niphlod
I understand all the steps involved and usually the operations you carried on lead to a database recreationbut there's a problem somewhere. If you deleted the sqlite database it *can't* complain about any data in it (leaving aside for one moment the format the data is in the field)... This

[web2py] Re: Associate a db record with a logged in user

2013-01-07 Thread Niphlod
Field('user_id', 'reference auth_user', default=auth.user_id) On Monday, January 7, 2013 9:31:33 PM UTC+1, Dave Cenker wrote: This seems so elementary, but I can't seem to find out how to do it in the book or googling the group ... I have several users defined and when that user is logged

[web2py] Re: Is it possible to define how a field is rendered in the DB model?

2013-01-07 Thread HittingSmoke
Thanks. Concerning saving the computed result, would that be another field which saves the post in HTML and using that field when rendering pages? I wouldn't think rendering markmin to HTML would be of an consequence on CPU load. I think the complication involved in storing the same data in two

[web2py] Re: Is it possible to define how a field is rendered in the DB model?

2013-01-07 Thread Anthony
represent only affects how the value is displayed in forms (including read-only forms) and the grid, whereas filter_out is applied when the database result is parsed into the Rows object, so it affects everywhere the value might be used or displayed. represent is often used with reference

[web2py] Delete a user

2013-01-07 Thread Daniele
What's the correct way of deleting a user? Say someone creates an account on my page and wants to remove him/herself. How can I do this? Thank you! --

Re: [web2py] Delete a user

2013-01-07 Thread Bruno Rocha
If you have shell access. Go to your shell python web2py.py -S yourappname -M db(db.auth_user.email==some...@domain.com).delete() db.commit() The user with some...@domain.com is now deleted! If you dont hace shell access, just go to your admi interface, database adminitration and delete

Re: [web2py] Delete a user

2013-01-07 Thread Daniele Pestilli
Well, I know I can do this from the admin interface but I was wondering how a user can remove himself from the website if he so wishes. Should I put the code `db(db.auth_user.email==some...@domain.com).delete()` in a {{=A(_href=action)}} or is that bad practice? I want the user to be able to

[web2py] Re: Is it possible to define how a field is rendered in the DB model?

2013-01-07 Thread Niphlod
it's completely up to you. Try to do some tests though. Unless you're storing millions of markmin fragments, having a row holding 0,2 KB of markmin source or 0,2+0,4 of markmin source + html at the end of the day means adding few megs up. On the other end, a reddited blog post having to render

Re: [web2py] Delete a user

2013-01-07 Thread villas
You can do it, but also consider what should happen to referenced records - be aware of any cascading deletes. On Monday, January 7, 2013 10:00:48 PM UTC, Daniele wrote: Well, I know I can do this from the admin interface but I was wondering how a user can remove himself from the website

[web2py] Re: self join on postgres

2013-01-07 Thread Niphlod
after a full day at work I may lack the usual fantasy, but what you're trying to do can't be even achieved by a relatively simple windowed function What you're trying to do is recursing. way out of DAL reach (if you want to do it in a single query) Trying to explain better Real

[web2py] Re: cpdb errors

2013-01-07 Thread Simon Ashley
Thanks Mart, That's sort of fixed it, but starting to get additional issues with the auth tables. https://lh4.googleusercontent.com/-HAmuqaTtnd0/UOtg3XU7NHI/AG8/LpeAt3Dm15w/s1600/copy+database2.png Think have seen this before with csv imports and have gotten around by deleting

[web2py] Re: tab separated csv file

2013-01-07 Thread rāma
I think the import button should have a delimiter field makes things easier. On Thursday, 12 March 2009 00:08:27 UTC+8, mdipierro wrote: There is no configuration parameter to do so. You mat create your own csv serializer. look into the python csv module. On Mar 11, 10:01 am, Marco

[web2py] Re: cpdb errors

2013-01-07 Thread mart
Hi Simon, Yes, that looks like a CSV error message. Possibly, the CSV format is missing something expected... I would say that the problem occurs when converting from CSV. I would suggest that you take a look at Massimo's CSVStudio @https://code.google.com/p/csvstudio/ i think it has

[web2py] Re: anyone tried jQuery svg?

2013-01-07 Thread Andrew W
I haven't either, but I'd recommend a look at d3js.org, if you want to use svg. I've done something similar to this one, using a web2py generated json data feed - data driven layout ! http://mbostock.github.com/d3/talk/2016/bundle.html On Monday, January 7, 2013 7:29:10 AM UTC+13,

[web2py] rocket can not send email on windows, starttls extension not supported by server

2013-01-07 Thread Tim Richardson
web2py 2.7.3 on windows, rocket server. I want to setup email for lost passwords and registration. I don't need authentication. I can send email from python (following the example in the 2.7.3 documentation 18.1.1) I've followed the book closely and have the mail server like so:

Re: [web2py] Jquery Kit

2013-01-07 Thread Kenny Chung
Thank you for the link, Bruno! On Mon, Jan 7, 2013 at 9:36 PM, Bruno Rocha rochacbr...@gmail.com wrote: An interesting set of Jquery plugins.. http://jquery-jkit.com/ Bruno -- --

[web2py] Re: cpdb errors

2013-01-07 Thread Simon Ashley
Thanks Mart, That gives me some clues and a renewed focus. Issue may be with postgres (at least the install I had - has been deleted and will be installed). Will also try ubuntu environment. Will report back ... --

[web2py] Re: rocket can not send email on windows, starttls extension not supported by server

2013-01-07 Thread Tim Richardson
This open source thing could really take off. mail.settings.tls = False does the job --

[web2py] Re: subforms / formsets / form cloning imprementation

2013-01-07 Thread howesc
i have an (untested) idea...plugging together a few things i have used before - you could create templates of field sets using handlebars: http://handlebarsjs.com/ then you can via JS add them to the page based on user interaction. - you can use hidden fields to provide some meta data

[web2py] Re: Bar encoded text fields

2013-01-07 Thread howesc
shouldn't non-list data types not accept list input? this sounds like an un-expected side effect to me. On Sunday, January 6, 2013 3:25:33 PM UTC-8, Massimo Di Pierro wrote: This is correct in the sense that since you try to store a list, web2py thinks it is a 'list:string' type of object

[web2py] Re: registration issue with web2py 2.3.2 [CLOSED]

2013-01-07 Thread weheh
Alright, I think I got this figured out. Issue is 2-fold. First, IS_LENGTH validator is executed after CRYPT() runs, so it fails. Moving IS_LENGTH to the array position before CRYPT() and changing password2 validator to ... requires=IS_EQUAL_TO(request.vars.password) ... causes things to work.