[web2py] Log delete event?

2013-04-18 Thread Richard
Hello,

How may I log a delete event?

form.process(ondelete=myeventlogcall)

?

It is not clear in the book if this work for SQLFORM. It seems to work for 
SQLFORM.grig and Crud, but there is no particular explanation in context of 
SQLFORM.

Thanks

Richard

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] "Converting" SQLite to DAL?

2013-04-18 Thread Alec Taylor
I finally completed a successful conversion of my Microsoft Access
database to SQLite 3; after trying numerous scripts on a couple of
platforms.

I used the `.dump` command to create a *.sql file with the `CREATE
TABLE` and associated statements.

Then using the "extract_sqlite_models.py" from the "scripts" folder I
generated some code; but found that what was generated was legacy
database accesses; it didn't generate the modern syntax with Field()
and whatnot.

How do I automate the conversion of the SQLite 3 database to web2py
DAL's syntax?

(furthermore would like to access the current .db from web2py; as
there is data there)

Thanks for all suggestions,

Alec Taylor

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Problem with the search when using two SQLFORM.grid on the same web page

2013-04-18 Thread Yuval
I am using two different SQLFORM.grid on the same page. 

Each is based on a different query and tables.

When I enter text and select search on one SQLFORM.grid, the same text is 
populated and search is executed on the other SQLFORM.grid.

Is there any way to prevent it?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] EmberJS is the web2py of the client! :)

2013-04-18 Thread Anthony
On Thursday, April 18, 2013 7:00:48 PM UTC-4, Arnon Marcus wrote:

> Well, as for the database, there are obvious security issues and 
> performance issues - I mean, having an open connection from all clients to 
> a single back-end database is a pretty nutty prospect for most serious 
> programmers...
>

I don't know all the details, but I don't think that's how it works. And 
from what I can tell, both the Derby and the Meteor folks are "serious 
programmers". 
 

> And as for No-SQL vs RDBM, well, again, it is a question of 
> target-audience - it depends on the level of complexity of inter-relation 
> in your use-case's data model, so as I said - complex data-model benefit 
> way too much from RDBMs and gain so little from No-SQL that it is simply 
> un-fit for them... But that's a different topic altogether.
>

https://unroll.me/ uses MySQL.
 

> As for no-refresh updates of the web-browser, it has nothing to do with 
> meteor/derby or even any kind of real-time app - it is a browser-extension, 
> coupled with a client/server library, that monitors your file-savings of 
> your code, and pushes updates to your development browser. There are many 
> such solutions today for many kinds of browsers and serves - it was just 
> easy to implement in node.js because it's all javascript on both ends... 
> There is nothing fundamentally restricting from doing this with web2py - 
> you can run an instance of node.js that basically only does "that" for you, 
> and still use web2py for all other stuff... It can even be implemented 
> inside web2py itself, with like a worker-thread or something... You can 
> even write something like this yourself - basically poll on file-changes of 
> your javascript code, and stream them over an open web-socket, and parse 
> them on your clien-side code to update your existing page...
>

I don't think Meteor or Derby are fully worked out yet, but neither is your 
hypothetical web2py variant that does all this. At the moment, Meteor and 
Derby at least have the advantage of existing. I think that's the point 
Ramos was making -- Meteor is doing some cool stuff now, not that such 
things couldn't in theory be implemented in another language/platform. 
Actually, 
in the Python world, there is (was?) the 
Planetframework, though it is proprietary and 
was quite expensive (looks like 
it's no longer active or available).

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Exemplo sobre tipos de relacionamento

2013-04-18 Thread Joao Guermandi
Muito obrigado !!!

Em quinta-feira, 18 de abril de 2013 18h39min36s UTC-3, Joao Guermandi 
escreveu:
>
> Onde consigo encontrar exemplos sobre relacionamento muitos para muitos e 
> um para muitos !!!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread fun man
hi Niphlod,

I've tried your example in the attachment. The good news is that the user
selected timezone it the profile/register page is working consistently!
Great work! Thank you!

The bad news is that the dynamic detection, and return from the client
session is still not working...
def index():
some_message = "here timezone is detected"
tz = fast_tz_detector()

I found out that tz is still not returning anything in the index page. That
should be my landing page, and once this is detected. I want to move this
value to the db. Then use it for the rest of the other functions in the
application.

I am reading your plugin, and it will take me some time to really figure
out what is going on inside fast_tz_detector()... Not sure why it didn't
return the thing I want :-)


On Thu, Apr 18, 2013 at 6:08 PM, fun man  wrote:

> Sorry Niphlod. I was on my phone, and didn't see this attachment. Thanks
> again for helping me out without asking for anything. I will try to learn
> from your example.
>
>
> On Fri, Apr 19, 2013 at 8:33 AM, Funmanhk  wrote:
>
>> Btw, I want to say that Niphlod has been very helpful. I am definitely
>> missing the HTML+JS knowledge, but that didn't stop me to try out in web2py
>> and have a good attempt on this issue.
>>
>> I am one little step away from solving this time zone problem haunting me
>> for a few months.  I wouldn't have the courage to start this adventure
>> without seeing the community's effort here.
>>
>> Thanks Niphlod, and everyone to create and support this.
>>
>> On 19 Apr, 2013, at 3:13, Niphlod  wrote:
>>
>> packed an app with a few examples: might explain better how to deal with
>> timezones.
>>
>> On Thursday, April 18, 2013 6:20:18 PM UTC+2, fun man wrote:
>>>
>>> yes. I am with you. I didn't store timezone in the db, and will be using
>>> UTC for all input to the db too.
>>>
>>> I hope to find a way to use the detected timezone to use in the
>>> .represent method for the sqlform.grid.
>>> db.prototype.modified_on.**represent = lambda value, row :
>>> pytz.UTC.localize(value).**astimezone(pytz.timezone('**Asia/Tokyo'))
>>>
>>> The above is working for me. I basically hardcode it to 'Asia/Tokyo'. I
>>> am trying to get the value from your plugin to replace my hard coded one
>>> above.
>>>
>>>
>>> On Fri, Apr 19, 2013 at 12:41 AM, Niphlod  wrote:
>>>
 the whole point of timezone normalization is NOT having "a timezone
 attached at the end".
 It's storing in the database as UTC and displaying as "localized" to
 the users.
 Are we sure that you fully grasped what the timezone implementation on
 the IS_DATE* validators in web2py and that that idea fits with your one ?


 On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:

> i am not using any specific language translation. It should be the
> default language.
>
> i also think that it is timezone issue, but not very sure how to do
> the normalization. The model i use is Field('modified_on', 
> 'datetime'),
> I see that there is no timezone attached at the end.
>
>
> On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  wrote:
>
>> that seems more a problem with the format of the date than the fact
>> that it has to be "timezone-normalized"what language translation are
>> you using ?
>>
>> PS: what I meant with "landing page" is that you're sure that the
>> user will hit that page before arriving to the form.
>> If you are sure, there's no need to embed the LOADed fragment in the
>> form page
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in
>> the Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/**
>> to**pic/web2py/aV1nNiDIwiY/**unsubsc**ribe?hl=en
>> .
>>  To unsubscribe from this group and all its topics, send an email to
>> web2py+un...@**googlegroups.com.
>>
>> For more options, visit 
>> https://groups.google.com/**grou**ps/opt_out
>> .
>>
>>
>>
>
>  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit https://groups.google.com/d/**
 topic/web2py/aV1nNiDIwiY/**unsubscribe?hl=en
 .
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .



>>>
>>>  --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit

Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread fun man
Sorry Niphlod. I was on my phone, and didn't see this attachment. Thanks
again for helping me out without asking for anything. I will try to learn
from your example.


On Fri, Apr 19, 2013 at 8:33 AM, Funmanhk  wrote:

> Btw, I want to say that Niphlod has been very helpful. I am definitely
> missing the HTML+JS knowledge, but that didn't stop me to try out in web2py
> and have a good attempt on this issue.
>
> I am one little step away from solving this time zone problem haunting me
> for a few months.  I wouldn't have the courage to start this adventure
> without seeing the community's effort here.
>
> Thanks Niphlod, and everyone to create and support this.
>
> On 19 Apr, 2013, at 3:13, Niphlod  wrote:
>
> packed an app with a few examples: might explain better how to deal with
> timezones.
>
> On Thursday, April 18, 2013 6:20:18 PM UTC+2, fun man wrote:
>>
>> yes. I am with you. I didn't store timezone in the db, and will be using
>> UTC for all input to the db too.
>>
>> I hope to find a way to use the detected timezone to use in the
>> .represent method for the sqlform.grid.
>> db.prototype.modified_on.**represent = lambda value, row :
>> pytz.UTC.localize(value).**astimezone(pytz.timezone('**Asia/Tokyo'))
>>
>> The above is working for me. I basically hardcode it to 'Asia/Tokyo'. I
>> am trying to get the value from your plugin to replace my hard coded one
>> above.
>>
>>
>> On Fri, Apr 19, 2013 at 12:41 AM, Niphlod  wrote:
>>
>>> the whole point of timezone normalization is NOT having "a timezone
>>> attached at the end".
>>> It's storing in the database as UTC and displaying as "localized" to the
>>> users.
>>> Are we sure that you fully grasped what the timezone implementation on
>>> the IS_DATE* validators in web2py and that that idea fits with your one ?
>>>
>>>
>>> On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:
>>>
 i am not using any specific language translation. It should be the
 default language.

 i also think that it is timezone issue, but not very sure how to do the
 normalization. The model i use is Field('modified_on', 'datetime'),
 I see that there is no timezone attached at the end.


 On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  wrote:

> that seems more a problem with the format of the date than the fact
> that it has to be "timezone-normalized"what language translation are
> you using ?
>
> PS: what I meant with "landing page" is that you're sure that the user
> will hit that page before arriving to the form.
> If you are sure, there's no need to embed the LOADed fragment in the
> form page
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**to
> **pic/web2py/aV1nNiDIwiY/**unsubsc**ribe?hl=en
> .
>  To unsubscribe from this group and all its topics, send an email to
> web2py+un...@**googlegroups.com.
>
> For more options, visit 
> https://groups.google.com/**grou**ps/opt_out
> .
>
>
>

  --
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/**
>>> topic/web2py/aV1nNiDIwiY/**unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+un...@**googlegroups.com.
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> 
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: hostmonster, pythonanywhere, or gae for my current situation

2013-04-18 Thread jjg0
I started checking out pythonanywhere but ran into some trouble getting my 
site up.  I was going through tutorials and decided to try using tortoise 
hg mercurial and bitbucket to get my site from my computer to 
pythonanywhere.  I was able to get mercurial on my computer and working, 
and upload my site to bitbucket.  I can now push changes and make a 
separate clone of the repository on my pc, but I still can't get the site 
working on pythonanywhere.  I tried using their bash console with the cmd 

hg clone https://m...@bitbucket.org/me/myproject.  

This works and I can see all my files on the pythonanywhere console, but it 
seems to always create and extra folder in pythonanywhere that does not 
happen on my pc.  So locally I have a folder that contains

\localfolder\.hg
\localfolder\web2py
\localfolder\.hgignore

when I push this to bitbucket it looks like this:

\mybitbucketproject\.hg
\mybitbucketproject\web2py
\mybitbucketproject\.hgignore


When I clone my repo in pythonanywhere I end up with an extra folder:

\mypythonanywherefolder\mybitbucketproject\.hg
\mypythonanywherefolder\mybitbucketproject\web2py
\mypythonanywherefolder\mybitbucketproject\.hgignore

I don't know why the 'mybitbucketproject' folder gets created, it looks 
like pythonanywhere isn't expecting it to be there to work.   I think it 
should look like '\mypythonanywhere\web2py' but I end up with an extra 
folder in between and my site doesn't work.  I just get an Unhandled 
Exception if I go to the site.  If I clone my repo on bitbucket to my pc I 
don't get that extra 'mybitbucketproject' folder.  I don't know why it only 
does that on pythonanywhere, and I'm not sure how to fix this.  I really 
don't know what I am doing, I only just found out what all this 'git' stuff 
was today.  I also had to look up what ssl was.  Getting a site working 
online seems to be the most difficult part for me.





On Tuesday, April 16, 2013 10:31:49 PM UTC-4, pallav wrote:
>
> 1. I do not have any experience with HostMonster. If they give you root 
> access to a Linux (hopefully Ubuntu) shell it should be straightforward to 
> install web2py (using the instructions from the book). It seems that this 
> option has the most unknowns for you.
>
> 2. PythonAnywhere allows you to have custom domains if you buy their Web 
> Developer account ($12/month -- https://www.pythonanywhere.com/pricing/). 
> They seem to be very responsive (active in user forums and blogs) and 
> should be able to walk you through any issues you encounter -- probably the 
> best option for you if you have limited experience. However over the last 
> few weeks of using them, I have found their servers to be unresponsive at 
> times (usually resolves itself within a 10-15 minutes). I'm on the free 
> account though, their paid account claims more bandwidth.
>
> 3. Google App Engine also supports custom domains. You will have to first 
> sign up for a Google Apps for Business (
> http://www.google.com/intl/en/enterprise/apps/business/) account - once 
> you log in, you can go into domain settings and verify that you have 
> ownership of the custom domain you are claiming (
> http://support.google.com/a/bin/topic.py?hl=en&topic=9196&parent=2426592&ctx=topic),
>  
> then you can set the rest of it up using the instructions at 
> https://developers.google.com/appengine/docs/domain . The cost will 
> probably come out to around what the PythonAnywhere account costs.
>
> Does your app need SSL? If so, Google App Engine may not work - SSL on 
> custom domain costs up to $40/month. If that is within your budget, it 
> seems the most stable/supported of your options.
>
> If that is too much, PythonAnywhere offers SSL, but you will have to work 
> with them via email/forums/phone (they need to install stuff manually for 
> you when I checked last).
>
>
> On Tuesday, April 16, 2013 8:43:55 PM UTC-4, jjg0 wrote:
>>
>> Hi Everyone
>>
>> I've been asked to replace a site for someone who currently has an 
>> account and domain with hostmonster. I made a demo for them they like with 
>> web2py and put it on google app engine. Aside from playing around with gae 
>> I've never actually deployed a web2py site.  Pythonanywhere seems like it 
>> would be the ideal option, in fact I probably should have been using them 
>> from the beginning.  But since everything I made is on gae and their 
>> current site is on hostmonster, it might be too late to consider 
>> pythonanywhere.  For people who have experience deploying web2py, which 
>> route do you think would be easier given what I currently have to work with 
>> and how would I go about getting everything set up?
>>
>> 1.  Just use their hostmonster account, in which case I have no idea how 
>> to get web2py working with them but hostmonster claims to support python.  
>> I'm guessing this would require the most work
>>
>> 2.  Create a pythonanywhere account and upload the site there, then 
>> somehow use their current domain name they have with

Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread Funmanhk
Btw, I want to say that Niphlod has been very helpful. I am definitely missing 
the HTML+JS knowledge, but that didn't stop me to try out in web2py and have a 
good attempt on this issue. 

I am one little step away from solving this time zone problem haunting me for a 
few months.  I wouldn't have the courage to start this adventure without seeing 
the community's effort here. 

Thanks Niphlod, and everyone to create and support this. 

On 19 Apr, 2013, at 3:13, Niphlod  wrote:

> packed an app with a few examples: might explain better how to deal with 
> timezones.
> 
> On Thursday, April 18, 2013 6:20:18 PM UTC+2, fun man wrote:
>> 
>> yes. I am with you. I didn't store timezone in the db, and will be using UTC 
>> for all input to the db too.
>> 
>> I hope to find a way to use the detected timezone to use in the .represent 
>> method for the sqlform.grid.
>> db.prototype.modified_on.represent = lambda value, row : 
>> pytz.UTC.localize(value).astimezone(pytz.timezone('Asia/Tokyo')) 
>> 
>> The above is working for me. I basically hardcode it to 'Asia/Tokyo'. I am 
>> trying to get the value from your plugin to replace my hard coded one above.
>> 
>> 
>> On Fri, Apr 19, 2013 at 12:41 AM, Niphlod  wrote:
>>> the whole point of timezone normalization is NOT having "a timezone 
>>> attached at the end". 
>>> It's storing in the database as UTC and displaying as "localized" to the 
>>> users.
>>> Are we sure that you fully grasped what the timezone implementation on the 
>>> IS_DATE* validators in web2py and that that idea fits with your one ?
>>> 
>>> 
>>> On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:
 i am not using any specific language translation. It should be the default 
 language.
 
 i also think that it is timezone issue, but not very sure how to do the 
 normalization. The model i use is Field('modified_on', 'datetime'), 
 I see that there is no timezone attached at the end.
 
 
 On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  wrote:
> that seems more a problem with the format of the date than the fact that 
> it has to be "timezone-normalized"what language translation are you 
> using ?
> 
> PS: what I meant with "landing page" is that you're sure that the user 
> will hit that page before arriving to the form.
> If you are sure, there's no need to embed the LOADed fragment in the form 
> page
> -- 
>  
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+un...@googlegroups.com.
> 
> For more options, visit https://groups.google.com/groups/opt_out.
>>> -- 
>>>  
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
> -- 
>  
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: One form in multiple tabs

2013-04-18 Thread Jose
This worked:

  {{=form.custom.begin}}


  View
  Modules
  Bank account
  Agree
  Confirm

   


  
{{=form.custom.widget.viewID}}
# a next button here
   
  
{{=form.custom.widget.moduleID}}
# a previous and next button here
   
  
{{=form.custom.widget.BIC}}
{{=form.custom.widget.IBAN}}
{{=form.custom.widget.holder}}
# a previous and next button here
   
  
{{=form.custom.widget.agreedTaC}}
{{=form.custom.widget.agreedDirectDebit}}
{{=form.custom.widget.submit}}

   
  
# confimation message here
   
 

{{=form.custom.end}} 

José

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Exemplo sobre tipos de relacionamento

2013-04-18 Thread Vinicius Assef
Joao, this is an English list.

You can find what you're looking for in links below:
- http://web2py.com/books/default/chapter/29/06#One-to-many-relation
- http://web2py.com/books/default/chapter/29/06#Many-to-many



On Thu, Apr 18, 2013 at 6:39 PM, Joao Guermandi  wrote:
> Onde consigo encontrar exemplos sobre relacionamento muitos para muitos e um
> para muitos !!!
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Alternative to SQLFORM for Angular

2013-04-18 Thread Alan Etkin
> I might take another look at the plugin_clientapi, but that looks to me 
like it is aimed at using web2py just as as a database backend.

Allow me completely disagree with that. plugin_clientapi handles creation 
and validation of forms (via the web2py api obviously), access control and 
authentication in the background asynchronously. It's api controller could 
be easily extended for allowing bulk insert/updates with client methods. It 
doesn't implement them because no one has asked for it as enhancement.

> I would like to keep the control within web2py but use angular to keep 
the client side code more concise.

AFAIK, that means adding custom code to AngularJS instead of reusing web2py 
code, unless we wait for a web2py adapter by the AngularJS team (just 
kidding).

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread Funmanhk
Thanks Niphlod. May I know where I can pick up the examples? 

Appreciate your help on this. 



On 19 Apr, 2013, at 3:13, Niphlod  wrote:

> packed an app with a few examples: might explain better how to deal with 
> timezones.
> 
> On Thursday, April 18, 2013 6:20:18 PM UTC+2, fun man wrote:
>> 
>> yes. I am with you. I didn't store timezone in the db, and will be using UTC 
>> for all input to the db too.
>> 
>> I hope to find a way to use the detected timezone to use in the .represent 
>> method for the sqlform.grid.
>> db.prototype.modified_on.represent = lambda value, row : 
>> pytz.UTC.localize(value).astimezone(pytz.timezone('Asia/Tokyo')) 
>> 
>> The above is working for me. I basically hardcode it to 'Asia/Tokyo'. I am 
>> trying to get the value from your plugin to replace my hard coded one above.
>> 
>> 
>> On Fri, Apr 19, 2013 at 12:41 AM, Niphlod  wrote:
>>> the whole point of timezone normalization is NOT having "a timezone 
>>> attached at the end". 
>>> It's storing in the database as UTC and displaying as "localized" to the 
>>> users.
>>> Are we sure that you fully grasped what the timezone implementation on the 
>>> IS_DATE* validators in web2py and that that idea fits with your one ?
>>> 
>>> 
>>> On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:
 i am not using any specific language translation. It should be the default 
 language.
 
 i also think that it is timezone issue, but not very sure how to do the 
 normalization. The model i use is Field('modified_on', 'datetime'), 
 I see that there is no timezone attached at the end.
 
 
 On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  wrote:
> that seems more a problem with the format of the date than the fact that 
> it has to be "timezone-normalized"what language translation are you 
> using ?
> 
> PS: what I meant with "landing page" is that you're sure that the user 
> will hit that page before arriving to the form.
> If you are sure, there's no need to embed the LOADed fragment in the form 
> page
> -- 
>  
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+un...@googlegroups.com.
> 
> For more options, visit https://groups.google.com/groups/opt_out.
>>> -- 
>>>  
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
> -- 
>  
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: One form in multiple tabs

2013-04-18 Thread Massimo Di Pierro
I am pretty sure Niphlod did not mean it in a sarcastic sense. We are from 
the same country and I did not read the negative connotation in his comment.

Niphlod is a main contributor to web2py and he spends lots of time helping 
people here.

Massimo

On Thursday, 18 April 2013 15:08:38 UTC-5, Pystar wrote:
>
> @Niphlod,
> People come here to get answers to their questions from experts like you 
> and not to be knocked down on. Your sarcasm of late is kind of offputting. 
> Kindly tone it down for the sake of this community. 
> Thanks
>
> On Wednesday, April 3, 2013 2:31:20 PM UTC+1, Niphlod wrote:
>>
>> the main issue here is : are you missing HTML/js skills to code a 
>> "tabbed" form or is something on web2py's side that is not working as you 
>> expect ?
>>
>> On Wednesday, April 3, 2013 1:11:21 PM UTC+2, Annet wrote:
>>>
>>> I defined the following table:
>>>
>>> db.define_table('scrptNxt',
>>> Field('nodeID','reference node',requires=IS_EMPTY_OR(IS_IN_DB(db,'
>>> node.id','%(id)s',zero='Select a 
>>> value')),ondelete='CASCADE',writable=False,readable=False),
>>> Field('viewID','reference view',requires=IS_EMPTY_OR(IS_IN_DB(db,'
>>> view.id','%(name)s')),ondelete='RESTRICT',label='View * 
>>> ',represent=lambda viewID, row: 
>>> db(db.view.id==viewID).select().first().name 
>>> if viewID else ''),
>>> Field('moduleID','list:reference 
>>> module',ondelete='RESTRICT',writable=False,readable=False,label='Module * 
>>> '), # requires= defined in function
>>> Field('BIC',length=16,requires=IS_LENGTH(16,error_message='lengte 
>>> overschreidt 16 tekens'),label='BIC * '),
>>> Field('IBAN',length=64,requires=IS_LENGTH(64,error_message='lengte 
>>> overschreidt 64 tekens'),label='IBAN * '),
>>> 
>>> Field('holder',length=128,requires=IS_LENGTH(128,error_message='lengte 
>>> overschreidt 128 tekens'),label='Tenaamstelling * '),
>>> 
>>> Field('agreedTaC',type='boolean',default=False,requires=IS_NOT_EMPTY(),notnull=True,label=None),
>>> Field('agreedDirectDebit',type='boolean',default=False,label=None),
>>> migrate=False)
>>>
>>>
>>> In a controller I defined the following function:
>>>
>>> def scrptNxt():
>>> 
>>> form=SQLFORM(table=db.scrptNxt,deletable=False,showid=False,separator='',formstyle=mybootstrap)
>>> form.process()
>>> if form.errors:
>>> response.flash=response_flash('formerror',session)
>>> elif not response.flash:
>>> response.flash=response_flash('form',session)
>>> return dict(form=form)
>>>
>>> In the corresponding view, I want the form to be displayed in tabs, 
>>> something like:
>>>
>>> 
>>>   View
>>>   Modules
>>>   Bank account
>>>   Agree
>>>   Confirm
>>> 
>>>
>>> 
>>>   {{=form.custom.begin}}
>>>   
>>> {{=form.custom.widget.viewID}}
>>> # a next button here
>>>
>>>   
>>> {{=form.custom.widget.moduleID}}
>>> # a previous and next button here
>>>
>>>   
>>> {{=form.custom.widget.BIC}}
>>> {{=form.custom.widget.IBAN}}
>>> {{=form.custom.widget.holder}}
>>> # a previous and next button here
>>>
>>>   
>>> {{=form.custom.widget.agreedTaC}}
>>> {{=form.custom.widget.agreedDirectDebit}}
>>> {{=form.custom.widget.submit}}
>>> {{=form.custom.end}} 
>>>
>>>   
>>> # confimation message here
>>>
>>>  
>>>
>>> I have no idea how to code this correctly, I look forward
>>> to your suggestions.
>>>
>>> Annet.
>>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] RESTful api and JSON POST data with curl

2013-04-18 Thread Brent Zeiben
Hi,
I am using a python script to organize some data and try to send it into 
web2py via the @request.restful() api.  In the python script the text is 
mainly input from a free form text field.  ( I believe some Unicode 
characters are in there as well, however I remove everything that is ord 
128 and above.) 

My problem arises when the text contains an ampersand (&) and probably 
anything that isn't allowed in without the form encoding.  I thought python 
json would escape the character some way but it does not seem to.

I am trying to use json to transfer this data to web2py via the curl 
command within python.

Python Script

import json
import subprocess


url = 'http://127.0.0.1:8000/testing/default/api/people.json'
data = {"name":"My Full Name","biography":"Some simple information\n about 
me & blah blah blah"}


jsondata = json.dumps(data)
result = subprocess.Popen(['curl',
   '--user','username:password',
   '-d',
   jsondata,
   url], stderr=subprocess.PIPE,stdout=subprocess.PIPE).communicate()[0]





The web2py relevant parts

db.py

db.define_table('people',
Field('name','string',length=200,requires=IS_NOT_EMPTY()),
Field('biography','text'))


default.py


auth.settings.allow_basic_login=True
@auth.requires_login()
@request.restful()
def api():
response.view = 'generic.' + request.extension
def POST(table_name,**vars):
if table_name == 'people':
return db.people.validate_and_insert(**vars)
else:
raise HTTP(400)
return locals()


So when the python script sends the data web2py complains because of the 
escaping issue with the & in the data.  I was doing some searching and 
thought that changing the Content Type in the curl command to 
application/json would help with this but then web2py has nothing in the 
vars variable.

Thank you,
Brent

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Joao Eugenio Guermandi

2013-04-18 Thread Joao Guermandi
Prezados amigos, onde consigo um exemplo do web2py para um cadastro entre 
uma tabela A que se relaciona com a tabela B, C, D, E de um para muitos 
...tipo um cadastro de clientes e cada cliente tem muitos contatos muitas 
duplicatas...não consegi achar um modelo para ver, ache no site do web2py 
 o relacionamento de muitos para um tranquilo... gostaria tambem de um 
exemplo de muitos para muitos  !!! 

desde já grato a todos

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Exemplo sobre tipos de relacionamento

2013-04-18 Thread Joao Guermandi
Onde consigo encontrar exemplos sobre relacionamento muitos para muitos e 
um para muitos !!!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] EmberJS is the web2py of the client! :)

2013-04-18 Thread Arnon Marcus
Well, as for the database, there are obvious security issues and
performance issues - I mean, having an open connection from all clients to
a single back-end database is a pretty nutty prospect for most serious
programmers...
Just think about connection-count,you can't even do connection pooling on
this... You basically need to have an extremely wide eventually-consistent
replication-cluster in the cloud, with like thousands of instances...
That's horribly inefficient. And in terms of security? Lot's of people are
still reluctant to trust the browser for even simple things like
client-side validation, you think that an open-connection to a back-end
database is gonna fly with these kind of folks?

And as for No-SQL vs RDBM, well, again, it is a question of
target-audience - it depends on the level of complexity of inter-relation
in your use-case's data model, so as I said - complex data-model benefit
way too much from RDBMs and gain so little from No-SQL that it is simply
un-fit for them... But that's a different topic altogether.

As for real-time synchronization, again, it may be implemented really well
in derby/meteor today, but I forsee that there are going to be many such
implementations for general use-cases.
I think there is an extension/version of web-sockets that is aimed at p2p,
so you can basically do it without any server at all, eventually.

As for no-refresh updates of the web-browser, it has nothing to do with
meteor/derby or even any kind of real-time app - it is a browser-extension,
coupled with a client/server library, that monitors your file-savings of
your code, and pushes updates to your development browser. There are many
such solutions today for many kinds of browsers and serves - it was just
easy to implement in node.js because it's all javascript on both ends...
There is nothing fundamentally restricting from doing this with web2py -
you can run an instance of node.js that basically only does "that" for you,
and still use web2py for all other stuff... It can even be implemented
inside web2py itself, with like a worker-thread or something... You can
even write something like this yourself - basically poll on file-changes of
your javascript code, and stream them over an open web-socket, and parse
them on your clien-side code to update your existing page...
In the p2p-web-socket future world, people could theoretically do crazy
stuff with that between each-other... :) Pretty diabolical shit...


On Thu, Apr 18, 2013 at 2:13 PM, António Ramos  wrote:

>  Nice comment but a minor correction.
> In meteor the client only has in his local database the documents he is
> allowed to read.
> That solves the security issues on the client.
>
> What I like most in meteor is
> Not having to refresh the browser on every change i make in code.
> Not having to code web sockets to deal with data change. Here we save a
> lot of code.
> Having all clients update automatically on every data change made by some
> client.
>
> For specific real time web apps I don't know  a better option.but that's
> just me.
>
>
>
> No dia Quinta-feira, 18 de Abril de 2013, Arnon 
> Marcusa.m.marcus@gmail.comescreveu:
>
>> Well, there is no "one-size-fit's-all", and there is never gonna be...
>>
>> Currently, expecting a direct-connection with the database from the
>> client side, still raises many eye-brows, and (IMHO) rightfully so...
>> But that is exactly the expectation that frameworks like meteor are
>> having.
>> Iy is not going to work in the foreseeable future, for many web-apps to
>> hold their entire database on the client side... There are way too many
>> things to consider when wanting to do that (security, privacy,
>> authorization, resource-use, etc.).
>> I also thing it's a mistake to assume the client-side even "needs" that,
>> for most cases.
>> As I said, the data-model that the client needs, is almost "always" very
>> different to the data-model in the database. For simple and small
>> web-sites, that may work out, but once you get pass a certain level of
>> complexity, and have hundreds of inter-linking tables, then in most of
>> these cases it would make no sense having an identical data model in the
>> client - it would be horobly wastefull and inefficient to the point of
>> being unusable.
>>
>> Also, the client-side is still very lacking in terms of options
>> of handling and handling relational data-models. Web2py's DAL is a god-sent
>> - it is an ORM that is second-to-none afaik.
>>
>> In short, it would fit a very, well, (ahm..) "boring" target-audience...
>> (no offence...)
>> Not for complex web-apps.
>>
>> I think you could achieve all the benefits of meteor/derby with a
>> hybrid-solution.
>> Generally, there is no problem with the idea of auto-synching data-models
>> across clients - it is actually a very exciting prospect - it should just
>> not be assumed to be applicable for the whole database, is an
>> "all-or-nothing" kind of way.
>> I see a better vision - a web-app that has compartmen

[web2py] Re: Cannot import module 'guppy', appadmin cache

2013-04-18 Thread BlueShadow
I did kill all processes remotly related to web2py an  uswgi and the 
internet restarted all and the cache page still wont load without that 
error.


On Thursday, April 18, 2013 11:08:14 PM UTC+2, Niphlod wrote:
>
> guppy has not been updated in a while, there are some known bugs with the 
> "stable release" and there seems to be already a bug listed on web2py's 
> "official issues".
> I tried to install it from sources, but didn't had luck with that either.
> Seems also that the debian package is somewhat oldie.. to sum up, I 
> never saw it working ^_^
>
> But if you uninstalled it and you restarted uwsgi (hard restart, better) 
> you should be able to get to your "need to install guppy" simple cache 
> page. Sure that you're restarting the uwsgi process (and not reloading it) ?
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] EmberJS is the web2py of the client! :)

2013-04-18 Thread António Ramos
 Nice comment but a minor correction.
In meteor the client only has in his local database the documents he is
allowed to read.
That solves the security issues on the client.

What I like most in meteor is
Not having to refresh the browser on every change i make in code.
Not having to code web sockets to deal with data change. Here we save a lot
of code.
Having all clients update automatically on every data change made by some
client.

For specific real time web apps I don't know  a better option.but that's
just me.



No dia Quinta-feira, 18 de Abril de 2013, Arnon
Marcusa.m.marcus@gmail.comescreveu:

> Well, there is no "one-size-fit's-all", and there is never gonna be...
>
> Currently, expecting a direct-connection with the database from the client
> side, still raises many eye-brows, and (IMHO) rightfully so...
> But that is exactly the expectation that frameworks like meteor are having.
> Iy is not going to work in the foreseeable future, for many web-apps to
> hold their entire database on the client side... There are way too many
> things to consider when wanting to do that (security, privacy,
> authorization, resource-use, etc.).
> I also thing it's a mistake to assume the client-side even "needs" that,
> for most cases.
> As I said, the data-model that the client needs, is almost "always" very
> different to the data-model in the database. For simple and small
> web-sites, that may work out, but once you get pass a certain level of
> complexity, and have hundreds of inter-linking tables, then in most of
> these cases it would make no sense having an identical data model in the
> client - it would be horobly wastefull and inefficient to the point of
> being unusable.
>
> Also, the client-side is still very lacking in terms of options
> of handling and handling relational data-models. Web2py's DAL is a god-sent
> - it is an ORM that is second-to-none afaik.
>
> In short, it would fit a very, well, (ahm..) "boring" target-audience...
> (no offence...)
> Not for complex web-apps.
>
> I think you could achieve all the benefits of meteor/derby with a
> hybrid-solution.
> Generally, there is no problem with the idea of auto-synching data-models
> across clients - it is actually a very exciting prospect - it should just
> not be assumed to be applicable for the whole database, is an
> "all-or-nothing" kind of way.
> I see a better vision - a web-app that has compartmentalized views, each
> within it's own little MVC world, and it's own data-model which represent a
> small portion of the database, structured specifically for that view's
> needs. Each of these components can have streaming communication with other
> instances of that save view in other browsers of other users, as well as
> with n instance of that same data-model on a server somewhere, which will
> take care of eventual-consistency in the background with the back-end
> database.
> I predict that this would be the model that would emergent to be
> the dominant one - you already see glimpses of it - Google Wave was an
> example - even long before web-sockets and data-store on the client. The
> entire google-gear architecture was an attempt at making something like
> this.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com  'web2py%2bunsubscr...@googlegroups.com');>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Anthony

>
> Iy is not going to work in the foreseeable future, for many web-apps to 
> hold their entire database on the client side...


Are you talking about the model definitions, or the actual data? They 
certainly don't move all the data in the entire database to the client.
 

> For simple and small web-sites, that may work out, but once you get pass a 
> certain level of complexity, and have hundreds of inter-linking tables, 
> then in most of these cases it would make no sense having an identical data 
> model in the client - it would be horobly wastefull and inefficient to the 
> point of being unusable.


At least Derby allows for server-only routes and models, in addition to 
whatever is on the client.
 

> Also, the client-side is still very lacking in terms of options 
> of handling and handling relational data-models.
>

I've noticed these frameworks tend to be geared toward document-based 
datastores, like MongoDB, rather than RDBMS's.
 

> In short, it would fit a very, well, (ahm..) "boring" target-audience... 
> (no offence...)
> Not for complex web-apps.
>

Not sure how complex these are, but they don't seem trivial, and certainly 
not "boring":

https://unroll.me/
https://www.habitrpg.com/static/front

I predict that this would be the model that would emergent to be 
> the dominant one - you already see glimpses of it - Google Wave was an 
> example - even long before web-sockets and data-store on the client.
>

Interestingly, one of the Google Wave developers went on to create ShareJS 
and now works on Derby (which is incorporating ShareJS).

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Cannot import module 'guppy', appadmin cache

2013-04-18 Thread Niphlod
guppy has not been updated in a while, there are some known bugs with the 
"stable release" and there seems to be already a bug listed on web2py's 
"official issues".
I tried to install it from sources, but didn't had luck with that either.
Seems also that the debian package is somewhat oldie.. to sum up, I 
never saw it working ^_^

But if you uninstalled it and you restarted uwsgi (hard restart, better) 
you should be able to get to your "need to install guppy" simple cache 
page. Sure that you're restarting the uwsgi process (and not reloading it) ?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Python Redis Queue

2013-04-18 Thread Niphlod
PS: on the web2py process side, it seems that at most 10 connections are 
istantiated with Redis: is there a connection pool?
On the worker side, instead, I noticed that each job generates a new fresh 
connection to Redis: is this expected ?
e.g. 
[7445] 18 Apr 22:57:48.072 - Client closed connection
[7445] 18 Apr 22:57:48.239 - Accepted 127.0.0.1:32972
[7445] 18 Apr 22:57:48.241 - Client closed connection
[7445] 18 Apr 22:57:48.406 - Accepted 127.0.0.1:32973
[7445] 18 Apr 22:57:48.408 - Client closed connection
[7445] 18 Apr 22:57:48.574 - Accepted 127.0.0.1:32974


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: display logo pic in header top

2013-04-18 Thread 黄祥
just wanna share what niphlod explained above:
i assume you store the logo in company table with the field trademark to 
save your image file

models/menu.py
rows = db(db.company.id == 1).select()
for row in rows:
response.logo = IMG(_src=URL('download', args=row.trademark), 
  _width="20px", _title=row.name, _class="brand")

it is ok, if you want to use html helper A(), but you must deal with css 
(padding, etc).

e.g.
response.logo = A(IMG(_src=URL('download', args=row.trademark), 
  _width="20px", _title=row.name), 
_class="brand",_href=row.website)

hope this can help
best regards

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Python Redis Queue

2013-04-18 Thread Niphlod
nice and easy :D keep up with the good work. 
As soon as the "official plugin page" gets revamped/refreshed, remember to 
post it there.

PS: I didn't watch inside python-rq since some time, seems to have gained 
some weight (even so, it's much simpler to grasp than celery) ^_^. 
Definitely the best solution if you're on Unix and have redis on your stack 
already, and you don't have crazy requirements.

On Thursday, April 18, 2013 7:19:07 PM UTC+2, Ricardo Pedroso wrote:
>
> On Thu, Apr 18, 2013 at 10:20 AM, Ricardo Pedroso 
> > 
> wrote: 
> > Now I remember seeing that thread, at the time I was with other things 
> > and end up forget it. 
> > 
> > I will see, later tonight or maybe this afternoon, what I can do about 
> > queueing functions in models. 
>
> I pushed it to github it has an example how to run functions defined in 
> models. 
> But now instead of runnig the worker in app_folder, the worker must be 
> run from web2py_folder 
>
> $ python applications//rq_worker.py 
>
>
> Ricardo 
>
>
>
>
>
> > 
> > 
> > 
> > On Thu, Apr 18, 2013 at 10:03 AM, Niphlod > 
> wrote: 
> >> here ... 
> https://groups.google.com/d/msg/web2py/js0VAKK6Dlw/CJ46I-0wT0wJ 
> >> 
> >> That is what you more or less described. 
> >> 
> >> if this works out in rq "linearly" I'll cross out "port web2py's 
> scheduler 
> >> to redis" from the todo list (it will be a nice project though) :P 
> >> 
> >> rq has the "react fast" juice but doesn't carry on some of the niceties 
> of 
> >> the internal scheduler. 
> >> 
> >> -- 
> >> 
> >> --- 
> >> You received this message because you are subscribed to the Google 
> Groups 
> >> "web2py-users" group. 
> >> To unsubscribe from this group and stop receiving emails from it, send 
> an 
> >> email to web2py+un...@googlegroups.com . 
> >> For more options, visit https://groups.google.com/groups/opt_out. 
> >> 
> >> 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Will web2py support database view? When?

2013-04-18 Thread Niphlod
defining a "fake table" that points to the view and set migrate=False is 
definitely the best (and recommended) way to do it.

On Thursday, April 18, 2013 10:19:05 PM UTC+2, David Ripplinger wrote:
>
> I'm not familiar with the Django way. Web2py is my first serious attempt 
> at web programming. What is the Django way, or (alternatively) what is the 
> cleanest way, to use database views in web2py? Should I just do the 
> define_table with migrate=False described by Vasile in this thread, or is 
> there another way I should know about?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: One form in multiple tabs

2013-04-18 Thread Niphlod
never tried to knock anyone down. 
As a matter of fact, I'm quite confident to have helped Annet lots of 
times, without asking anything in return.
If it's something on web2py's side to get patched I'm more than glad to 
chime in, but I decided to not "tutor" on html+js and spend the time 
"saved" helping web2py to work more intuitively (contributing with code).

To be completely honest, I'm kinda thrown off by comments like yours: if I 
have an answer to give I give it, if I have a question to ask, I ask it. 
>From then on, if I choose to answer or not (leaving the reply to others) 
shouldn't be anyone's concern: picture me on the beach, coding patches, 
writing plugins, drinking beers, watching television, doing whatever : I'm 
not paid for this ^_^

web2py-users is not a pure-python list where your posts gets rejected if 
you ask something about the web world... that being said, is a web2py list, 
so we try (me mostly) to remain in topic at least with the 
web2py-related-web-environment.
"The repliers" are for the 90% 10 peoples: massimo, jonathan, anthony, 
alan, bruno, pbreit, richard, paolo, etc (fellow mates, don't get upset if 
you don't show up on the previous list). 
According to the statistics this month the group is reaching 1500 posts: 
the 33% of it comes from yours truly "the repliers".
I'd really like to see this "community" grow without "the repliers" (pun 
intended :-P) : give us a little space if sometimes an answer that all 
previous web2py newbies tackled and resolved by trial and error has no 
replies from "the repliers": they are drinking beer. 

On Thursday, April 18, 2013 10:08:38 PM UTC+2, Pystar wrote:
>
> @Niphlod,
> People come here to get answers to their questions from experts like you 
> and not to be knocked down on. Your sarcasm of late is kind of offputting. 
> Kindly tone it down for the sake of this community. 
> Thanks
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Cannot import module 'guppy', appadmin cache

2013-04-18 Thread BlueShadow
Hi,
I wanted to get some information on my cache usage. so I went to the cache 
page in appadmin which worked fine at that moment but told me I need guppy 
in order to get the size of the cache.
So I installed it. now I get an error page which tells me guppy cannot be 
imported.
I restarted nginx/uswgi and web2py which had no effekt.
I even tried to uninstall guppy but the error message stays the same.
Any ideas?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Arnon Marcus
Well, there is no "one-size-fit's-all", and there is never gonna be...

Currently, expecting a direct-connection with the database from the client 
side, still raises many eye-brows, and (IMHO) rightfully so...
But that is exactly the expectation that frameworks like meteor are having.
Iy is not going to work in the foreseeable future, for many web-apps to 
hold their entire database on the client side... There are way too many 
things to consider when wanting to do that (security, privacy, 
authorization, resource-use, etc.).
I also thing it's a mistake to assume the client-side even "needs" that, 
for most cases.
As I said, the data-model that the client needs, is almost "always" very 
different to the data-model in the database. For simple and small 
web-sites, that may work out, but once you get pass a certain level of 
complexity, and have hundreds of inter-linking tables, then in most of 
these cases it would make no sense having an identical data model in the 
client - it would be horobly wastefull and inefficient to the point of 
being unusable.

Also, the client-side is still very lacking in terms of options 
of handling and handling relational data-models. Web2py's DAL is a god-sent 
- it is an ORM that is second-to-none afaik.

In short, it would fit a very, well, (ahm..) "boring" target-audience... 
(no offence...)
Not for complex web-apps.

I think you could achieve all the benefits of meteor/derby with a 
hybrid-solution.
Generally, there is no problem with the idea of auto-synching data-models 
across clients - it is actually a very exciting prospect - it should just 
not be assumed to be applicable for the whole database, is an 
"all-or-nothing" kind of way.
I see a better vision - a web-app that has compartmentalized views, each 
within it's own little MVC world, and it's own data-model which represent a 
small portion of the database, structured specifically for that view's 
needs. Each of these components can have streaming communication with other 
instances of that save view in other browsers of other users, as well as 
with n instance of that same data-model on a server somewhere, which will 
take care of eventual-consistency in the background with the back-end 
database.
I predict that this would be the model that would emergent to be 
the dominant one - you already see glimpses of it - Google Wave was an 
example - even long before web-sockets and data-store on the client. The 
entire google-gear architecture was an attempt at making something like 
this. 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Will web2py support database view? When?

2013-04-18 Thread David Ripplinger
I'm not familiar with the Django way. Web2py is my first serious attempt at 
web programming. What is the Django way, or (alternatively) what is the 
cleanest way, to use database views in web2py? Should I just do the 
define_table with migrate=False described by Vasile in this thread, or is 
there another way I should know about?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Alternative to SQLFORM for Angular

2013-04-18 Thread RHC
Thanks for the responses, a number of useful pointers there.

I have had a look at the sqlhtml.py and html.py to see if I can adapt one 
of these to effectively produce a json version of a form which can be 
validated when it is submitted. I came to the conclusion that I didn't 
understand enough of what was going on in these to adapt them. Also, I 
don't need a lot of the stuff done in these. So maybe I should create my 
own methods

I have narrowed down the functionality I want to the following:
- CSRF and double submit prevention.
- prevent changes to records changed since form download
- Validation of the fields, followed by an insert, update, or delete. Or 
return of field specific errors if validation fails.

I can see how the CSRF and double submit is prevented, and preventing the 
update of a record that has changed. However, I have not found where the 
methods web2py uses to validate each field and generate select lists etc. 
Can anyone point me to where these are so I can re-use these?

I would like to be able to send an array of multiple records to the client 
along with some basic model information such as data types and selection 
items, then the client would allow the editing of any of the items using a 
generic form and then submit data for all modified, deleted, or new items.

I might take another look at the plugin_clientapi, but that looks to me 
like it is aimed at using web2py just as as a database backend. I would 
like to keep the control within web2py but use angular to keep the client 
side code more concise.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: One form in multiple tabs

2013-04-18 Thread Pystar
@Niphlod,
People come here to get answers to their questions from experts like you 
and not to be knocked down on. Your sarcasm of late is kind of offputting. 
Kindly tone it down for the sake of this community. 
Thanks

On Wednesday, April 3, 2013 2:31:20 PM UTC+1, Niphlod wrote:
>
> the main issue here is : are you missing HTML/js skills to code a "tabbed" 
> form or is something on web2py's side that is not working as you expect ?
>
> On Wednesday, April 3, 2013 1:11:21 PM UTC+2, Annet wrote:
>>
>> I defined the following table:
>>
>> db.define_table('scrptNxt',
>> Field('nodeID','reference node',requires=IS_EMPTY_OR(IS_IN_DB(db,'
>> node.id','%(id)s',zero='Select a 
>> value')),ondelete='CASCADE',writable=False,readable=False),
>> Field('viewID','reference view',requires=IS_EMPTY_OR(IS_IN_DB(db,'
>> view.id','%(name)s')),ondelete='RESTRICT',label='View * 
>> ',represent=lambda viewID, row: db(db.view.id==viewID).select().first().name 
>> if viewID else ''),
>> Field('moduleID','list:reference 
>> module',ondelete='RESTRICT',writable=False,readable=False,label='Module * 
>> '), # requires= defined in function
>> Field('BIC',length=16,requires=IS_LENGTH(16,error_message='lengte 
>> overschreidt 16 tekens'),label='BIC * '),
>> Field('IBAN',length=64,requires=IS_LENGTH(64,error_message='lengte 
>> overschreidt 64 tekens'),label='IBAN * '),
>> 
>> Field('holder',length=128,requires=IS_LENGTH(128,error_message='lengte 
>> overschreidt 128 tekens'),label='Tenaamstelling * '),
>> 
>> Field('agreedTaC',type='boolean',default=False,requires=IS_NOT_EMPTY(),notnull=True,label=None),
>> Field('agreedDirectDebit',type='boolean',default=False,label=None),
>> migrate=False)
>>
>>
>> In a controller I defined the following function:
>>
>> def scrptNxt():
>> 
>> form=SQLFORM(table=db.scrptNxt,deletable=False,showid=False,separator='',formstyle=mybootstrap)
>> form.process()
>> if form.errors:
>> response.flash=response_flash('formerror',session)
>> elif not response.flash:
>> response.flash=response_flash('form',session)
>> return dict(form=form)
>>
>> In the corresponding view, I want the form to be displayed in tabs, 
>> something like:
>>
>> 
>>   View
>>   Modules
>>   Bank account
>>   Agree
>>   Confirm
>> 
>>
>> 
>>   {{=form.custom.begin}}
>>   
>> {{=form.custom.widget.viewID}}
>> # a next button here
>>
>>   
>> {{=form.custom.widget.moduleID}}
>> # a previous and next button here
>>
>>   
>> {{=form.custom.widget.BIC}}
>> {{=form.custom.widget.IBAN}}
>> {{=form.custom.widget.holder}}
>> # a previous and next button here
>>
>>   
>> {{=form.custom.widget.agreedTaC}}
>> {{=form.custom.widget.agreedDirectDebit}}
>> {{=form.custom.widget.submit}}
>> {{=form.custom.end}} 
>>
>>   
>> # confimation message here
>>
>>  
>>
>> I have no idea how to code this correctly, I look forward
>> to your suggestions.
>>
>> Annet.
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Excellent Video about web2py but no sound or subtitles

2013-04-18 Thread jjg0
I was a little worried about the no sound or subtitles part but it's 
actually a really great video!.  I'd love to see more like this, especially 
if commentary or notes could be added.

On Wednesday, April 17, 2013 6:19:06 AM UTC-4, Ramos wrote:
>
> http://vimeo.com/8229814
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Anthony
Another similar (though somewhat less mature) option is 
Derby(also built on Node.js). Advantages over Meteor are 
two-way data binding 
and the ability to render on the server as well as the client (for search 
engine crawling and faster initial page loads).

Anthony

On Thursday, April 18, 2013 1:20:57 PM UTC-4, Ramos wrote:
>
> as i understood , the discussion seems to be the around single page apps 
> that have its code in the client and then just push/pull data from the 
> server.
>
> meteor takes care of this problem and we just have to subscribe to changes 
> in reactive data sources.
> Its less code to worry about. No ajax! Just works! The client keeps a 
> local copy of the mongo database that gets sync with server.
>
> The way i see it, its "AWSOME". 
> Now you try to convinve me otherwise. :)
>
> Best regards
>
> António
>
>
>
> 2013/4/18 Derek >
>
>> What's the question that it's supposed to answer?
>>
>>
>> On Thursday, April 18, 2013 8:13:55 AM UTC-7, Ramos wrote:
>>
>>> is meteor the answer?
>>>
>>>
>>> 2013/4/18 Magnitus 
>>>
 I'm not even sure I'll go with Angular myself at this point. I'll delve 
 more deeply into that framework once I feel I have a sufficient grasp of 
 Ember.

 For the whole server-side dynamically generating client-side, I'm 
 afraid it's not my vision.

 The direction things are moving toward is to move away from the server 
 dynamically generating client-side and rather have the client-side 
 generate 
 itself using data it gets from the server.

 I've done both and I find that having the client-side generate itself 
 is the cleaner approach in the end (though it probably has a steeper 
 learning curve, unfortunately). In essence, it makes the "V" part of MVC 
 more trivial for the server and moves more of that logic on the 
 client-side 
 where I think it belongs.

 The way I'd see web2py supporting "widgets" is simply to provide some 
 protocol (currently via ajax) that the client-side expects from the server 
 to update itself. Maybe also javascript files for different frameworks 
 (vanilla jQuery, Ember, Angular) if you want some pre-made solutions so 
 that web2py can be as interoperable on the client side as it is on the 
 backend (where you can choose from many different servers and databases). 

 On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:
>
>
>
> On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:
>>
>> Well, basically, it limited the usefulness of the form facilities and 
>> the tight default integration between authentication and the rendered 
>> pages 
>> took some time to bypass and then there was stripping the layout.html 
>> file 
>> to it's bare essentials.
>>
>> Overall, I've always been much happier to use web2py for it's 
>> server-side features and let it be a flexible interface with which 100% 
>> custom-made client-side code could interact.
>>
>>  
> yeah. the real problem is that no-one working on angularjs is making 
> public its own widgets. 
> All that it takes is overloading SQLFORM.widgets and given that we 
> ship web2py with a formstyle parameter that can be a callable from some 
> time, all that is needed is something that generates angular templates 
> out 
> of models (and someone that is willing to do it). 
> Once stable, that formstyle can be included in standard web2py and the 
> "newwidgets.py" module shipped in gluon/contrib.
> then SQLFORM(thetable, formstyle='angularjs') will be all what's needed
>
> Right now I don't have any interest in angularjs so I call myself out 
> of the competition, but feel free to pack a starter app and I'll be more 
> than glad to review the code.
>
>
>  -- 
  
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .
  
  

>>>
>>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Anthony
Note, the cache doesn't do anything to clear out old items, so if you 
change the key every day, the previous day's page will still remain in the 
cache. You might want to do something to purge the old page out of the 
cache.

Also, are you absolutely sure returnDatestring() is returning only the date 
and not also the time?

Anthony

On Thursday, April 18, 2013 1:17:26 PM UTC-4, BlueShadow wrote:
>
> So you are basicly saying I did exactly what I wanted to do save the 
> entire generated page on disk.
> So how can I find out what is taking so long for the page to load?
>
> @Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
> every day at midnight the data changes. if for some reason the page is 
> cached later than 00:05 (I got a cronjob with a curl to visit that page) 
> the new version will be calculated regardless of whether there is still a 
> cached version or not. (because the date changes)
>
> On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>>
>> Basically it stores the output of the function, in your case the output 
>> is the rendered view.
>> For more info about cache, have a look here: 
>> http://web2py.com/books/default/chapter/29/04#cache
>>
>> Paolo
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Niphlod
for starters check the "cache" page in appadmin (go to "database 
administration", then click "cache" at the top) to see hot many hits/misses 
you find.
In a "perfect world" ( i.e. your cache works as expected) you'd have 1 miss 
and n-1 hits with n being the number of times your page is accessed.

On Thursday, April 18, 2013 7:17:26 PM UTC+2, BlueShadow wrote:
>
> So you are basicly saying I did exactly what I wanted to do save the 
> entire generated page on disk.
> So how can I find out what is taking so long for the page to load?
>
> @Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
> every day at midnight the data changes. if for some reason the page is 
> cached later than 00:05 (I got a cronjob with a curl to visit that page) 
> the new version will be calculated regardless of whether there is still a 
> cached version or not. (because the date changes)
>
> On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>>
>> Basically it stores the output of the function, in your case the output 
>> is the rendered view.
>> For more info about cache, have a look here: 
>> http://web2py.com/books/default/chapter/29/04#cache
>>
>> Paolo
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Niphlod
for starters, not all sites can be converted into the "single page app" 
paradigm.
On the brigther note, if you need just that, then meteor is built with that 
agenda in mind: try to diverge just a little and you won't leverage its 
potential. 

On Thursday, April 18, 2013 7:20:57 PM UTC+2, Ramos wrote:
>
> as i understood , the discussion seems to be the around single page apps 
> that have its code in the client and then just push/pull data from the 
> server.
>
> meteor takes care of this problem and we just have to subscribe to changes 
> in reactive data sources.
> Its less code to worry about. No ajax! Just works! The client keeps a 
> local copy of the mongo database that gets sync with server.
>
> The way i see it, its "AWSOME". 
> Now you try to convinve me otherwise. :)
>
> Best regards
>
> António
>
>
>
> 2013/4/18 Derek >
>
>> What's the question that it's supposed to answer?
>>
>>
>> On Thursday, April 18, 2013 8:13:55 AM UTC-7, Ramos wrote:
>>
>>> is meteor the answer?
>>>
>>>
>>> 2013/4/18 Magnitus 
>>>
 I'm not even sure I'll go with Angular myself at this point. I'll delve 
 more deeply into that framework once I feel I have a sufficient grasp of 
 Ember.

 For the whole server-side dynamically generating client-side, I'm 
 afraid it's not my vision.

 The direction things are moving toward is to move away from the server 
 dynamically generating client-side and rather have the client-side 
 generate 
 itself using data it gets from the server.

 I've done both and I find that having the client-side generate itself 
 is the cleaner approach in the end (though it probably has a steeper 
 learning curve, unfortunately). In essence, it makes the "V" part of MVC 
 more trivial for the server and moves more of that logic on the 
 client-side 
 where I think it belongs.

 The way I'd see web2py supporting "widgets" is simply to provide some 
 protocol (currently via ajax) that the client-side expects from the server 
 to update itself. Maybe also javascript files for different frameworks 
 (vanilla jQuery, Ember, Angular) if you want some pre-made solutions so 
 that web2py can be as interoperable on the client side as it is on the 
 backend (where you can choose from many different servers and databases). 

 On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:
>
>
>
> On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:
>>
>> Well, basically, it limited the usefulness of the form facilities and 
>> the tight default integration between authentication and the rendered 
>> pages 
>> took some time to bypass and then there was stripping the layout.html 
>> file 
>> to it's bare essentials.
>>
>> Overall, I've always been much happier to use web2py for it's 
>> server-side features and let it be a flexible interface with which 100% 
>> custom-made client-side code could interact.
>>
>>  
> yeah. the real problem is that no-one working on angularjs is making 
> public its own widgets. 
> All that it takes is overloading SQLFORM.widgets and given that we 
> ship web2py with a formstyle parameter that can be a callable from some 
> time, all that is needed is something that generates angular templates 
> out 
> of models (and someone that is willing to do it). 
> Once stable, that formstyle can be included in standard web2py and the 
> "newwidgets.py" module shipped in gluon/contrib.
> then SQLFORM(thetable, formstyle='angularjs') will be all what's needed
>
> Right now I don't have any interest in angularjs so I call myself out 
> of the competition, but feel free to pack a starter app and I'll be more 
> than glad to review the code.
>
>
>  -- 
  
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .
  
  

>>>
>>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: One form in multiple tabs

2013-04-18 Thread Jose


El miércoles, 3 de abril de 2013 08:11:21 UTC-3, Annet escribió:
>
> I defined the following table:
>
> db.define_table('scrptNxt',
> Field('nodeID','reference node',requires=IS_EMPTY_OR(IS_IN_DB(db,'
> node.id','%(id)s',zero='Select a 
> value')),ondelete='CASCADE',writable=False,readable=False),
> Field('viewID','reference view',requires=IS_EMPTY_OR(IS_IN_DB(db,'
> view.id','%(name)s')),ondelete='RESTRICT',label='View * 
> ',represent=lambda viewID, row: db(db.view.id==viewID).select().first().name 
> if viewID else ''),
> Field('moduleID','list:reference 
> module',ondelete='RESTRICT',writable=False,readable=False,label='Module * 
> '), # requires= defined in function
> Field('BIC',length=16,requires=IS_LENGTH(16,error_message='lengte 
> overschreidt 16 tekens'),label='BIC * '),
> Field('IBAN',length=64,requires=IS_LENGTH(64,error_message='lengte 
> overschreidt 64 tekens'),label='IBAN * '),
> Field('holder',length=128,requires=IS_LENGTH(128,error_message='lengte 
> overschreidt 128 tekens'),label='Tenaamstelling * '),
> 
> Field('agreedTaC',type='boolean',default=False,requires=IS_NOT_EMPTY(),notnull=True,label=None),
> Field('agreedDirectDebit',type='boolean',default=False,label=None),
> migrate=False)
>
>
> In a controller I defined the following function:
>
> def scrptNxt():
> 
> form=SQLFORM(table=db.scrptNxt,deletable=False,showid=False,separator='',formstyle=mybootstrap)
> form.process()
> if form.errors:
> response.flash=response_flash('formerror',session)
> elif not response.flash:
> response.flash=response_flash('form',session)
> return dict(form=form)
>
> In the corresponding view, I want the form to be displayed in tabs, 
> something like:
>
> 
>   View
>   Modules
>   Bank account
>   Agree
>   Confirm
> 
>
> 
>   {{=form.custom.begin}}
>   
> {{=form.custom.widget.viewID}}
> # a next button here
>
>   
> {{=form.custom.widget.moduleID}}
> # a previous and next button here
>
>   
> {{=form.custom.widget.BIC}}
> {{=form.custom.widget.IBAN}}
> {{=form.custom.widget.holder}}
> # a previous and next button here
>
>   
> {{=form.custom.widget.agreedTaC}}
> {{=form.custom.widget.agreedDirectDebit}}
> {{=form.custom.widget.submit}}
> {{=form.custom.end}} 
>
>   
> # confimation message here
>
>  
>
> I have no idea how to code this correctly, I look forward
> to your suggestions.
>
> Annet.
>

Hello Annet

You could solve it? I need to do something similar.

thanks

José 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Conditional deletes (ondelete etc) in sqlform.grid

2013-04-18 Thread Mark
deletable = False
if 'edit' in request.args:
record = db[table](request.args[-1])
if some condition of record:
deletable = True
grid = SQLFORM.grid(db[table], deletable = deletable)


On Sunday, April 14, 2013 3:12:31 PM UTC-4, Dan wrote:
>
> Mark Kirkwood  writes: 
>
> > 
> > 
> > I've worked around this by tackling the issue a different way: 
> > - disable the delete button on the grid altogether with 
> > deletable=False 
> > - selectively enable it in edit mode for records that are 
> > safe/appropriate to delete 
>
> How did you do that? I'm experiencing the same problem! 
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread António Ramos
as i understood , the discussion seems to be the around single page apps
that have its code in the client and then just push/pull data from the
server.

meteor takes care of this problem and we just have to subscribe to changes
in reactive data sources.
Its less code to worry about. No ajax! Just works! The client keeps a local
copy of the mongo database that gets sync with server.

The way i see it, its "AWSOME".
Now you try to convinve me otherwise. :)

Best regards

António



2013/4/18 Derek 

> What's the question that it's supposed to answer?
>
>
> On Thursday, April 18, 2013 8:13:55 AM UTC-7, Ramos wrote:
>
>> is meteor the answer?
>>
>>
>> 2013/4/18 Magnitus 
>>
>>> I'm not even sure I'll go with Angular myself at this point. I'll delve
>>> more deeply into that framework once I feel I have a sufficient grasp of
>>> Ember.
>>>
>>> For the whole server-side dynamically generating client-side, I'm afraid
>>> it's not my vision.
>>>
>>> The direction things are moving toward is to move away from the server
>>> dynamically generating client-side and rather have the client-side generate
>>> itself using data it gets from the server.
>>>
>>> I've done both and I find that having the client-side generate itself is
>>> the cleaner approach in the end (though it probably has a steeper learning
>>> curve, unfortunately). In essence, it makes the "V" part of MVC more
>>> trivial for the server and moves more of that logic on the client-side
>>> where I think it belongs.
>>>
>>> The way I'd see web2py supporting "widgets" is simply to provide some
>>> protocol (currently via ajax) that the client-side expects from the server
>>> to update itself. Maybe also javascript files for different frameworks
>>> (vanilla jQuery, Ember, Angular) if you want some pre-made solutions so
>>> that web2py can be as interoperable on the client side as it is on the
>>> backend (where you can choose from many different servers and databases).
>>>
>>> On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:



 On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:
>
> Well, basically, it limited the usefulness of the form facilities and
> the tight default integration between authentication and the rendered 
> pages
> took some time to bypass and then there was stripping the layout.html file
> to it's bare essentials.
>
> Overall, I've always been much happier to use web2py for it's
> server-side features and let it be a flexible interface with which 100%
> custom-made client-side code could interact.
>
>
 yeah. the real problem is that no-one working on angularjs is making
 public its own widgets.
 All that it takes is overloading SQLFORM.widgets and given that we ship
 web2py with a formstyle parameter that can be a callable from some time,
 all that is needed is something that generates angular templates out of
 models (and someone that is willing to do it).
 Once stable, that formstyle can be included in standard web2py and the
 "newwidgets.py" module shipped in gluon/contrib.
 then SQLFORM(thetable, formstyle='angularjs') will be all what's needed

 Right now I don't have any interest in angularjs so I call myself out
 of the competition, but feel free to pack a starter app and I'll be more
 than glad to review the code.


  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Python Redis Queue

2013-04-18 Thread Ricardo Pedroso
On Thu, Apr 18, 2013 at 10:20 AM, Ricardo Pedroso  wrote:
> Now I remember seeing that thread, at the time I was with other things
> and end up forget it.
>
> I will see, later tonight or maybe this afternoon, what I can do about
> queueing functions in models.

I pushed it to github it has an example how to run functions defined in models.
But now instead of runnig the worker in app_folder, the worker must be
run from web2py_folder

$ python applications//rq_worker.py


Ricardo





>
>
>
> On Thu, Apr 18, 2013 at 10:03 AM, Niphlod  wrote:
>> here ... https://groups.google.com/d/msg/web2py/js0VAKK6Dlw/CJ46I-0wT0wJ
>>
>> That is what you more or less described.
>>
>> if this works out in rq "linearly" I'll cross out "port web2py's scheduler
>> to redis" from the todo list (it will be a nice project though) :P
>>
>> rq has the "react fast" juice but doesn't carry on some of the niceties of
>> the internal scheduler.
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread BlueShadow
So you are basicly saying I did exactly what I wanted to do save the entire 
generated page on disk.
So how can I find out what is taking so long for the page to load?

@Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
every day at midnight the data changes. if for some reason the page is 
cached later than 00:05 (I got a cronjob with a curl to visit that page) 
the new version will be calculated regardless of whether there is still a 
cached version or not. (because the date changes)

On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>
> Basically it stores the output of the function, in your case the output is 
> the rendered view.
> For more info about cache, have a look here: 
> http://web2py.com/books/default/chapter/29/04#cache
>
> Paolo
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Derek
What's the question that it's supposed to answer?

On Thursday, April 18, 2013 8:13:55 AM UTC-7, Ramos wrote:
>
> is meteor the answer?
>
>
> 2013/4/18 Magnitus >
>
>> I'm not even sure I'll go with Angular myself at this point. I'll delve 
>> more deeply into that framework once I feel I have a sufficient grasp of 
>> Ember.
>>
>> For the whole server-side dynamically generating client-side, I'm afraid 
>> it's not my vision.
>>
>> The direction things are moving toward is to move away from the server 
>> dynamically generating client-side and rather have the client-side generate 
>> itself using data it gets from the server.
>>
>> I've done both and I find that having the client-side generate itself is 
>> the cleaner approach in the end (though it probably has a steeper learning 
>> curve, unfortunately). In essence, it makes the "V" part of MVC more 
>> trivial for the server and moves more of that logic on the client-side 
>> where I think it belongs.
>>
>> The way I'd see web2py supporting "widgets" is simply to provide some 
>> protocol (currently via ajax) that the client-side expects from the server 
>> to update itself. Maybe also javascript files for different frameworks 
>> (vanilla jQuery, Ember, Angular) if you want some pre-made solutions so 
>> that web2py can be as interoperable on the client side as it is on the 
>> backend (where you can choose from many different servers and databases). 
>>
>> On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:
>>>
>>>
>>>
>>> On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:

 Well, basically, it limited the usefulness of the form facilities and 
 the tight default integration between authentication and the rendered 
 pages 
 took some time to bypass and then there was stripping the layout.html file 
 to it's bare essentials.

 Overall, I've always been much happier to use web2py for it's 
 server-side features and let it be a flexible interface with which 100% 
 custom-made client-side code could interact.

  
>>> yeah. the real problem is that no-one working on angularjs is making 
>>> public its own widgets. 
>>> All that it takes is overloading SQLFORM.widgets and given that we ship 
>>> web2py with a formstyle parameter that can be a callable from some time, 
>>> all that is needed is something that generates angular templates out of 
>>> models (and someone that is willing to do it). 
>>> Once stable, that formstyle can be included in standard web2py and the 
>>> "newwidgets.py" module shipped in gluon/contrib.
>>> then SQLFORM(thetable, formstyle='angularjs') will be all what's needed
>>>
>>> Right now I don't have any interest in angularjs so I call myself out of 
>>> the competition, but feel free to pack a starter app and I'll be more than 
>>> glad to review the code.
>>>
>>>
>>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Derek
Why would you be using 'returnDatestring + Somepage' as your key to the 
cache?


On Thursday, April 18, 2013 9:17:36 AM UTC-7, BlueShadow wrote:
>
> Hi I got a site which calls some major calculating. So I thought lets use 
> the cache decoator to speed up second time loads.
> But it doesnt seem to have any effekt on pageloading times.
> @cache(returnDatestring()+"Somepage", time_expire=86000, cache_model=cache
> .disk)
> def Somepage():
> #some time intensive calculations
> return response.render(l=l)
>
> So with and without the @cache decorator it takes about 25 seconds for the 
> page to load. (yeah my server is slow I know) As far as I understand it the 
> whole age should be stored on the disk and be served as a static page. 
> which should load instantly.
> Or is just the output of the function stored and the view has to be 
> rendered afterwards? (the view has a big table with like 100 rows, there 
> are calculated some sums too)
> If so can I cache the entire view?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Paolo valleri
Basically it stores the output of the function, in your case the output is 
the rendered view.
For more info about cache, have a look here: 
http://web2py.com/books/default/chapter/29/04#cache

Paolo

On Thursday, April 18, 2013 6:17:36 PM UTC+2, BlueShadow wrote:
>
> Hi I got a site which calls some major calculating. So I thought lets use 
> the cache decoator to speed up second time loads.
> But it doesnt seem to have any effekt on pageloading times.
> @cache(returnDatestring()+"Somepage", time_expire=86000, cache_model=cache
> .disk)
> def Somepage():
> #some time intensive calculations
> return response.render(l=l)
>
> So with and without the @cache decorator it takes about 25 seconds for the 
> page to load. (yeah my server is slow I know) As far as I understand it the 
> whole age should be stored on the disk and be served as a static page. 
> which should load instantly.
> Or is just the output of the function stored and the view has to be 
> rendered afterwards? (the view has a big table with like 100 rows, there 
> are calculated some sums too)
> If so can I cache the entire view?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread fun man
yes. I am with you. I didn't store timezone in the db, and will be using
UTC for all input to the db too.

I hope to find a way to use the detected timezone to use in the .represent
method for the sqlform.grid.
db.prototype.modified_on.represent = lambda value, row :
pytz.UTC.localize(value).astimezone(pytz.timezone('Asia/Tokyo'))

The above is working for me. I basically hardcode it to 'Asia/Tokyo'. I am
trying to get the value from your plugin to replace my hard coded one above.


On Fri, Apr 19, 2013 at 12:41 AM, Niphlod  wrote:

> the whole point of timezone normalization is NOT having "a timezone
> attached at the end".
> It's storing in the database as UTC and displaying as "localized" to the
> users.
> Are we sure that you fully grasped what the timezone implementation on the
> IS_DATE* validators in web2py and that that idea fits with your one ?
>
>
> On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:
>
>> i am not using any specific language translation. It should be the
>> default language.
>>
>> i also think that it is timezone issue, but not very sure how to do the
>> normalization. The model i use is Field('modified_on', 'datetime'),
>> I see that there is no timezone attached at the end.
>>
>>
>> On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  wrote:
>>
>>> that seems more a problem with the format of the date than the fact that
>>> it has to be "timezone-normalized"what language translation are you
>>> using ?
>>>
>>> PS: what I meant with "landing page" is that you're sure that the user
>>> will hit that page before arriving to the form.
>>> If you are sure, there's no need to embed the LOADed fragment in the
>>> form page
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/**
>>> topic/web2py/aV1nNiDIwiY/**unsubscribe?hl=en
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] @cache decorator

2013-04-18 Thread BlueShadow
Hi I got a site which calls some major calculating. So I thought lets use 
the cache decoator to speed up second time loads.
But it doesnt seem to have any effekt on pageloading times.
@cache(returnDatestring()+"Somepage", time_expire=86000, cache_model=cache.
disk)
def Somepage():
#some time intensive calculations
return response.render(l=l)

So with and without the @cache decorator it takes about 25 seconds for the 
page to load. (yeah my server is slow I know) As far as I understand it the 
whole age should be stored on the disk and be served as a static page. 
which should load instantly.
Or is just the output of the function stored and the view has to be 
rendered afterwards? (the view has a big table with like 100 rows, there 
are calculated some sums too)
If so can I cache the entire view?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] ip in session file different than real ip and ip in auth_event that is the real ip

2013-04-18 Thread Richard Vézina
Ok, erase cookies seems to have solve this one...

Richard


On Thu, Apr 18, 2013 at 11:55 AM, Richard wrote:

> Hello,
>
> I have a pretty weird behavior with web2py 2.3.2 as stated in the object.
> When I am connecting to app with Chrome in windows the session file is
> named like this 192.168.1.102... But my IP is 192.168.1.110 and in
> auth_event I see the proper IP address.
>
> Any idea?
>
> Thanks
>
> Richard
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] ip in session file different than real ip and ip in auth_event that is the real ip

2013-04-18 Thread Richard
Hello,

I have a pretty weird behavior with web2py 2.3.2 as stated in the object. 
When I am connecting to app with Chrome in windows the session file is 
named like this 192.168.1.102... But my IP is 192.168.1.110 and in 
auth_event I see the proper IP address. 

Any idea?

Thanks

Richard

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: “Exceeded soft private memory limit” when upload (1.56M) on GAE

2013-04-18 Thread 冷春辉
Hello Christian,

Thank you very much for explaining. The reason is clear to me now. I will
try to work around it.

Regards,
Lio


On Thu, Apr 18, 2013 at 11:23 PM, Christian Foster Howes
wrote:

> Lio,
>
> there are potentially 2 problems here:
>  - the request thread is using too much memory/has a memory lead
>  - the size of the file is too large.
>
> i know you are having the second problem, not sure about the first.  it's
> possible that the second problem is being reported to you with a
> mis-leading message.
>
> as for the file size, i am assuming that you are trying to store the file
> directly on a row in the table.  Remember that on GAE, when using the
> datastore, each row is limited to 1MB total, and any given field is limited
> to 1MB (which you can only achieve if the row contains 1 field).
>
> To grow past this limitation, look into the GAE blobstore for storing
> large files.  you also can write tools that upload the file to some other
> location (google cloud storage, amazon S3) and store the link to the file
> in your table.
>
> hope that helps!
>
> cfh
>
>
> On Tuesday, April 16, 2013 7:25:16 PM UTC-7, Lio wrote:
>>
>> Hello,
>>
>> Today the first time I got 500 Server Error when trying to upload a file
>> of 1.56MB as a field of a record in a table. When checking GAE logs it
>> shows "*Exceeded soft private memory limit with 20x.xxx MB after
>> servicing XXX requests total*" every time I tried to upload the same
>> file.
>>
>> I've done the same operation several time without any problem, I guess
>> it's very likely caused by the file size, so I reduced the file size to
>> less than 600K then the uploading succeeded.
>>
>> My question is what is the limit of upload file size and also in case I
>> really need to upload a big file what could be the solution?
>>
>> Thanks for advice.
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/NTtV2sOI6Ss/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread Niphlod
the whole point of timezone normalization is NOT having "a timezone 
attached at the end". 
It's storing in the database as UTC and displaying as "localized" to the 
users.
Are we sure that you fully grasped what the timezone implementation on the 
IS_DATE* validators in web2py and that that idea fits with your one ?

On Thursday, April 18, 2013 4:35:51 PM UTC+2, fun man wrote:
>
> i am not using any specific language translation. It should be the default 
> language.
>
> i also think that it is timezone issue, but not very sure how to do the 
> normalization. The model i use is Field('modified_on', 'datetime'), 
> I see that there is no timezone attached at the end.
>
>
> On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  >wrote:
>
>> that seems more a problem with the format of the date than the fact that 
>> it has to be "timezone-normalized"what language translation are you 
>> using ?
>>
>> PS: what I meant with "landing page" is that you're sure that the user 
>> will hit that page before arriving to the form.
>> If you are sure, there's no need to embed the LOADed fragment in the form 
>> page 
>>
>> -- 
>>  
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Niphlod
it's definitely not for a lot of reasons, but if you like to dwelve with 
*buzzword*, give it a spin.

On Thursday, April 18, 2013 5:13:55 PM UTC+2, Ramos wrote:
>
> is meteor the answer?
>
>
> 2013/4/18 Magnitus >
>
>> I'm not even sure I'll go with Angular myself at this point. I'll delve 
>> more deeply into that framework once I feel I have a sufficient grasp of 
>> Ember.
>>
>> For the whole server-side dynamically generating client-side, I'm afraid 
>> it's not my vision.
>>
>> The direction things are moving toward is to move away from the server 
>> dynamically generating client-side and rather have the client-side generate 
>> itself using data it gets from the server.
>>
>> I've done both and I find that having the client-side generate itself is 
>> the cleaner approach in the end (though it probably has a steeper learning 
>> curve, unfortunately). In essence, it makes the "V" part of MVC more 
>> trivial for the server and moves more of that logic on the client-side 
>> where I think it belongs.
>>
>> The way I'd see web2py supporting "widgets" is simply to provide some 
>> protocol (currently via ajax) that the client-side expects from the server 
>> to update itself. Maybe also javascript files for different frameworks 
>> (vanilla jQuery, Ember, Angular) if you want some pre-made solutions so 
>> that web2py can be as interoperable on the client side as it is on the 
>> backend (where you can choose from many different servers and databases). 
>>
>> On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:
>>>
>>>
>>>
>>> On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:

 Well, basically, it limited the usefulness of the form facilities and 
 the tight default integration between authentication and the rendered 
 pages 
 took some time to bypass and then there was stripping the layout.html file 
 to it's bare essentials.

 Overall, I've always been much happier to use web2py for it's 
 server-side features and let it be a flexible interface with which 100% 
 custom-made client-side code could interact.

  
>>> yeah. the real problem is that no-one working on angularjs is making 
>>> public its own widgets. 
>>> All that it takes is overloading SQLFORM.widgets and given that we ship 
>>> web2py with a formstyle parameter that can be a callable from some time, 
>>> all that is needed is something that generates angular templates out of 
>>> models (and someone that is willing to do it). 
>>> Once stable, that formstyle can be included in standard web2py and the 
>>> "newwidgets.py" module shipped in gluon/contrib.
>>> then SQLFORM(thetable, formstyle='angularjs') will be all what's needed
>>>
>>> Right now I don't have any interest in angularjs so I call myself out of 
>>> the competition, but feel free to pack a starter app and I'll be more than 
>>> glad to review the code.
>>>
>>>
>>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: “Exceeded soft private memory limit” when upload (1.56M) on GAE

2013-04-18 Thread Christian Foster Howes
Lio,

there are potentially 2 problems here:
 - the request thread is using too much memory/has a memory lead
 - the size of the file is too large.

i know you are having the second problem, not sure about the first.  it's 
possible that the second problem is being reported to you with a 
mis-leading message.

as for the file size, i am assuming that you are trying to store the file 
directly on a row in the table.  Remember that on GAE, when using the 
datastore, each row is limited to 1MB total, and any given field is limited 
to 1MB (which you can only achieve if the row contains 1 field).

To grow past this limitation, look into the GAE blobstore for storing large 
files.  you also can write tools that upload the file to some other 
location (google cloud storage, amazon S3) and store the link to the file 
in your table.

hope that helps!

cfh

On Tuesday, April 16, 2013 7:25:16 PM UTC-7, Lio wrote:
>
> Hello,
>
> Today the first time I got 500 Server Error when trying to upload a file 
> of 1.56MB as a field of a record in a table. When checking GAE logs it 
> shows "*Exceeded soft private memory limit with 20x.xxx MB after 
> servicing XXX requests total*" every time I tried to upload the same 
> file. 
>
> I've done the same operation several time without any problem, I guess 
> it's very likely caused by the file size, so I reduced the file size to 
> less than 600K then the uploading succeeded. 
>
> My question is what is the limit of upload file size and also in case I 
> really need to upload a big file what could be the solution?
>
> Thanks for advice.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread António Ramos
is meteor the answer?


2013/4/18 Magnitus 

> I'm not even sure I'll go with Angular myself at this point. I'll delve
> more deeply into that framework once I feel I have a sufficient grasp of
> Ember.
>
> For the whole server-side dynamically generating client-side, I'm afraid
> it's not my vision.
>
> The direction things are moving toward is to move away from the server
> dynamically generating client-side and rather have the client-side generate
> itself using data it gets from the server.
>
> I've done both and I find that having the client-side generate itself is
> the cleaner approach in the end (though it probably has a steeper learning
> curve, unfortunately). In essence, it makes the "V" part of MVC more
> trivial for the server and moves more of that logic on the client-side
> where I think it belongs.
>
> The way I'd see web2py supporting "widgets" is simply to provide some
> protocol (currently via ajax) that the client-side expects from the server
> to update itself. Maybe also javascript files for different frameworks
> (vanilla jQuery, Ember, Angular) if you want some pre-made solutions so
> that web2py can be as interoperable on the client side as it is on the
> backend (where you can choose from many different servers and databases).
>
> On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:
>>
>>
>>
>> On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:
>>>
>>> Well, basically, it limited the usefulness of the form facilities and
>>> the tight default integration between authentication and the rendered pages
>>> took some time to bypass and then there was stripping the layout.html file
>>> to it's bare essentials.
>>>
>>> Overall, I've always been much happier to use web2py for it's
>>> server-side features and let it be a flexible interface with which 100%
>>> custom-made client-side code could interact.
>>>
>>>
>> yeah. the real problem is that no-one working on angularjs is making
>> public its own widgets.
>> All that it takes is overloading SQLFORM.widgets and given that we ship
>> web2py with a formstyle parameter that can be a callable from some time,
>> all that is needed is something that generates angular templates out of
>> models (and someone that is willing to do it).
>> Once stable, that formstyle can be included in standard web2py and the
>> "newwidgets.py" module shipped in gluon/contrib.
>> then SQLFORM(thetable, formstyle='angularjs') will be all what's needed
>>
>> Right now I don't have any interest in angularjs so I call myself out of
>> the competition, but feel free to pack a starter app and I'll be more than
>> glad to review the code.
>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: EmberJS is the web2py of the client! :)

2013-04-18 Thread Magnitus
I'm not even sure I'll go with Angular myself at this point. I'll delve 
more deeply into that framework once I feel I have a sufficient grasp of 
Ember.

For the whole server-side dynamically generating client-side, I'm afraid 
it's not my vision.

The direction things are moving toward is to move away from the server 
dynamically generating client-side and rather have the client-side generate 
itself using data it gets from the server.

I've done both and I find that having the client-side generate itself is 
the cleaner approach in the end (though it probably has a steeper learning 
curve, unfortunately). In essence, it makes the "V" part of MVC more 
trivial for the server and moves more of that logic on the client-side 
where I think it belongs.

The way I'd see web2py supporting "widgets" is simply to provide some 
protocol (currently via ajax) that the client-side expects from the server 
to update itself. Maybe also javascript files for different frameworks 
(vanilla jQuery, Ember, Angular) if you want some pre-made solutions so 
that web2py can be as interoperable on the client side as it is on the 
backend (where you can choose from many different servers and databases). 

On Tuesday, 16 April 2013 17:12:48 UTC-4, Niphlod wrote:
>
>
>
> On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:
>>
>> Well, basically, it limited the usefulness of the form facilities and the 
>> tight default integration between authentication and the rendered pages 
>> took some time to bypass and then there was stripping the layout.html file 
>> to it's bare essentials.
>>
>> Overall, I've always been much happier to use web2py for it's server-side 
>> features and let it be a flexible interface with which 100% custom-made 
>> client-side code could interact.
>>
>>  
> yeah. the real problem is that no-one working on angularjs is making 
> public its own widgets. 
> All that it takes is overloading SQLFORM.widgets and given that we ship 
> web2py with a formstyle parameter that can be a callable from some time, 
> all that is needed is something that generates angular templates out of 
> models (and someone that is willing to do it). 
> Once stable, that formstyle can be included in standard web2py and the 
> "newwidgets.py" module shipped in gluon/contrib.
> then SQLFORM(thetable, formstyle='angularjs') will be all what's needed
>
> Right now I don't have any interest in angularjs so I call myself out of 
> the competition, but feel free to pack a starter app and I'll be more than 
> glad to review the code.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread fun man
i am not using any specific language translation. It should be the default
language.

i also think that it is timezone issue, but not very sure how to do the
normalization. The model i use is Field('modified_on', 'datetime'),
I see that there is no timezone attached at the end.


On Thu, Apr 18, 2013 at 7:11 PM, Niphlod  wrote:

> that seems more a problem with the format of the date than the fact that
> it has to be "timezone-normalized"what language translation are you
> using ?
>
> PS: what I meant with "landing page" is that you're sure that the user
> will hit that page before arriving to the form.
> If you are sure, there's no need to embed the LOADed fragment in the form
> page
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Old DAL bug (?) ValueError: invalid literal for int() with base 10: 'AssetTypes\\Character.png'

2013-04-18 Thread Massimo Di Pierro
That is a very old version of web2py. It is hard to support something so 
old. you should be able to upgrade and nothing should break.
The only case I have seen something like this is when a string field 
contained data (strings) and was converted in a reference field using 
sqlite. Or a "list:string" converted in a "list:reference".


On Thursday, 18 April 2013 03:50:34 UTC-5, Arnon Marcus wrote:
>
> Can somebody pleas respond?
>
> We are quite desperate here about this...
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Full text search query

2013-04-18 Thread Anthony
In your other examples, one or more fields are passed to the .select(), so 
the DAL has a way to know which table is being queried. When you pass only 
a string as the query and no fields to .select(), the DAL has no way to 
know which table is involved (it does not inspect string queries -- it just 
inserts them into the SQL as is).

Anthony

On Thursday, April 18, 2013 8:40:15 AM UTC-4, Johann Spies wrote:
>
> In another app I can do:
>
>   
> query = "akb_articles.tsv@@'simple','%'" % request.search_for
>   
> and then
>
> form = SQLFORM.grid(query)
>
> or another variation:
>
> query = "akb_articles.tsv@@to_tsquery('simple', '%s')" % ss
>
> or something like this:
>
> l = db("akb_articles.tsv@@'kerkreg | (church & (polity | 
> government))'").select(db.akb_articles.title)
>
>
> but all these variations in the present application result in the same 
> error I get the correct result in psql:
>
> l = db("rauthor.addressfulltext@@'simple', 'south & africa'").select()
> l = db("rauthor.addressfulltext@@to_tsquery('simple', 'south & 
> africa')").select()
> l = db("rauthor.addressfulltext@@'South & Africa'").select()
>
> Regards
> Johann
>
>
> On 18 April 2013 13:55, Anthony > wrote:
>
>> For me, db("rauthor.addressfulltext@@'**south & africa'").select() 
>> results in "SyntaxError: Set: no tables selected" because the query is a 
>> string and no fields were passed to .select().
>>
>> Anthony
>>
>>
>> On Thursday, April 18, 2013 7:46:42 AM UTC-4, Johann Spies wrote:
>>>
>>> In psql I can do:
>>>
>>> select * from isi.rauthor A
>>> where 
>>> A.addressfulltext@@'south & africa'
>>>
>>>
>>> but the following 
>>>
>>>  l = db("rauthor.addressfulltext@@'**south & africa'").select()
>>>
>>> results in 
>>>
>>> TypeError: %d format: a number is required, not NoneType
>>>
>>>
>>> Why?
>>>
>>> Model:
>>>
>>> from gluon.dal import SQLCustomType
>>> tsv = SQLCustomType( 
>>> type ='text',
>>> native='tsvector' )
>>> ...
>>>   Field('addressfulltext',type=**tsv),
>>>
>>>
>>> Regards
>>> Johann
>>> -- 
>>> Because experiencing your loyal love is better than life itself, 
>>> my lips will praise you.  (Psalm 63:3)
>>>  
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Full text search query

2013-04-18 Thread Johann Spies
In another app I can do:


query = "akb_articles.tsv@@'simple','%'" % request.search_for

and then

form = SQLFORM.grid(query)

or another variation:

query = "akb_articles.tsv@@to_tsquery('simple', '%s')" % ss

or something like this:

l = db("akb_articles.tsv@@'kerkreg | (church & (polity |
government))'").select(db.akb_articles.title)


but all these variations in the present application result in the same
error I get the correct result in psql:

l = db("rauthor.addressfulltext@@'simple', 'south & africa'").select()
l = db("rauthor.addressfulltext@@to_tsquery('simple', 'south &
africa')").select()
l = db("rauthor.addressfulltext@@'South & Africa'").select()

Regards
Johann


On 18 April 2013 13:55, Anthony  wrote:

> For me, db("rauthor.addressfulltext@@'**south & africa'").select()
> results in "SyntaxError: Set: no tables selected" because the query is a
> string and no fields were passed to .select().
>
> Anthony
>
>
> On Thursday, April 18, 2013 7:46:42 AM UTC-4, Johann Spies wrote:
>>
>> In psql I can do:
>>
>> select * from isi.rauthor A
>> where
>> A.addressfulltext@@'south & africa'
>>
>>
>> but the following
>>
>>  l = db("rauthor.addressfulltext@@'**south & africa'").select()
>>
>> results in
>>
>> TypeError: %d format: a number is required, not NoneType
>>
>>
>> Why?
>>
>> Model:
>>
>> from gluon.dal import SQLCustomType
>> tsv = SQLCustomType(
>> type ='text',
>> native='tsvector' )
>> ...
>>   Field('addressfulltext',type=**tsv),
>>
>>
>> Regards
>> Johann
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: db._common_fields.append and Lazy_tables

2013-04-18 Thread Loïc
That's clear for me now
Thank you

Le jeudi 18 avril 2013 14:32:12 UTC+2, Anthony a écrit :
>
> This syntax:
>
> 'reference %s' % auth.settings.table_user_name
>
> is not about being lazy tables compliant -- it is just a way to construct 
> a string when part of the string is stored in a variable (another option 
> would be 'reference ' + auth.settings.table_user_name). You could just as 
> easily do:
>
> 'reference auth_user'
>
> The former syntax just allows for cases where you don't want to hard-code 
> the name of the user table into your field definition (in case you decide 
> to change it at some point). The problem with your original field 
> definition was that you specified the field object itself (i.e., 
> auth.settings.table_user), which requires that the table already exists. 
> The "reference" syntax just requires the table name, not the table object.
>
> Anthony
>
> On Thursday, April 18, 2013 8:25:50 AM UTC-4, Loïc wrote:
>>
>> One more question Anthony,
>> If I have other tables which reference themselves like :
>>
>> db.define_table('mytable',Field('myfield','string'))
>> db.define_table('my_other_table',Field('myTable','reference mytable'))
>>
>> should I replace the* 'reference mytable' *statement with* 'reference 
>> %s' % I_dont_know_what*' to be "lazy_tables compliant"?
>> Thank you
>>
>> Le jeudi 18 avril 2013 13:59:18 UTC+2, Anthony a écrit :
>>>
>>> Have the auth tables been defined at that point. In any case, to avoid 
>>> pre-mature table definition, try replacing auth.settings.table_user with:
>>>
>>> 'reference %s' % auth.settings.table_user_name
>>>
>>> Anthony
>>>
>>> On Thursday, April 18, 2013 7:51:19 AM UTC-4, Loïc wrote:

 Hello All

 consider the example model file below :

 db = DAL('sqlite://storage.sqlite')

 signature = db.Table(db,'auth_signature',
   Field('created_on','datetime',default=request.now,
 writable=False,readable=False, label=T('Created on')),
 Field('created_by',auth.settings.table_user,default=auth.
 user_id,
 writable=False,readable=False, label=T('Created by')),
 Field('modified_on','datetime',update=request.now,default=
 request.now,
 writable=False,readable=False, label=T('Modified on')),
   Field('modified_by',auth.settings.table_user,
 default=auth.user_id,update=auth.user_id,
 writable=False,readable=False, label=T('Modified by'))
   )

 db._common_fields.append(signature)

 db.define_table('mytable',Field('myfield','string'))
 db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())

 Then, if I want to activate lazy_tables 
 db = DAL('sqlite://storage.sqlite', lazy_tables=True)

 I got the following error that I don't really understand.
 Can anyone explain me?
 Thank you 

 Error ticket for "test" Ticket ID 

 127.0.0.1.2013-04-18.13-47-51.4d08ccf5-8d25-4cf1-a8dd-081d76046b7a
  'NoneType' object has no attribute 
 'startswith' Version  web2py™ Version 
 2.4.5-stable+timestamp.2013.03.18.22.46.22  Python Python 2.7.3: 
 C:\Python27\python.exe (prefix: C:\Python27)  Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.

 Traceback (most recent call last):
   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\restricted.py", 
 line 212, in restricted
 exec ccode in environment
   File "C:/Users/MCR/Google 
 Drive/loic/web2py/web2py/applications/test/models/db.py" 
 , line 101, in 
 
 db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
 7790, in __getattr__
 return self.lazy_define_table(tablename,*fields,**args)
   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
 7714, in lazy_define_table
 polymodel=polymodel)
   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
 776, in create_table
 elif field_type.startswith('reference'):
 AttributeError: 'NoneType' object has no attribute 'startswith'




-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: db._common_fields.append and Lazy_tables

2013-04-18 Thread Anthony
This syntax:

'reference %s' % auth.settings.table_user_name

is not about being lazy tables compliant -- it is just a way to construct a 
string when part of the string is stored in a variable (another option 
would be 'reference ' + auth.settings.table_user_name). You could just as 
easily do:

'reference auth_user'

The former syntax just allows for cases where you don't want to hard-code 
the name of the user table into your field definition (in case you decide 
to change it at some point). The problem with your original field 
definition was that you specified the field object itself (i.e., 
auth.settings.table_user), which requires that the table already exists. 
The "reference" syntax just requires the table name, not the table object.

Anthony

On Thursday, April 18, 2013 8:25:50 AM UTC-4, Loïc wrote:
>
> One more question Anthony,
> If I have other tables which reference themselves like :
>
> db.define_table('mytable',Field('myfield','string'))
> db.define_table('my_other_table',Field('myTable','reference mytable'))
>
> should I replace the* 'reference mytable' *statement with* 'reference %s' 
> % I_dont_know_what*' to be "lazy_tables compliant"?
> Thank you
>
> Le jeudi 18 avril 2013 13:59:18 UTC+2, Anthony a écrit :
>>
>> Have the auth tables been defined at that point. In any case, to avoid 
>> pre-mature table definition, try replacing auth.settings.table_user with:
>>
>> 'reference %s' % auth.settings.table_user_name
>>
>> Anthony
>>
>> On Thursday, April 18, 2013 7:51:19 AM UTC-4, Loïc wrote:
>>>
>>> Hello All
>>>
>>> consider the example model file below :
>>>
>>> db = DAL('sqlite://storage.sqlite')
>>>
>>> signature = db.Table(db,'auth_signature',
>>>   Field('created_on','datetime',default=request.now,
>>> writable=False,readable=False, label=T('Created on')),
>>> Field('created_by',auth.settings.table_user,default=auth.user_id
>>> ,
>>> writable=False,readable=False, label=T('Created by')),
>>> Field('modified_on','datetime',update=request.now,default=
>>> request.now,
>>> writable=False,readable=False, label=T('Modified on')),
>>>   Field('modified_by',auth.settings.table_user,
>>> default=auth.user_id,update=auth.user_id,
>>> writable=False,readable=False, label=T('Modified by'))
>>>   )
>>>
>>> db._common_fields.append(signature)
>>>
>>> db.define_table('mytable',Field('myfield','string'))
>>> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>>>
>>> Then, if I want to activate lazy_tables 
>>> db = DAL('sqlite://storage.sqlite', lazy_tables=True)
>>>
>>> I got the following error that I don't really understand.
>>> Can anyone explain me?
>>> Thank you 
>>>
>>> Error ticket for "test" Ticket ID 
>>>
>>> 127.0.0.1.2013-04-18.13-47-51.4d08ccf5-8d25-4cf1-a8dd-081d76046b7a
>>>  'NoneType' object has no attribute 
>>> 'startswith' Version  web2py™ Version 
>>> 2.4.5-stable+timestamp.2013.03.18.22.46.22  Python Python 2.7.3: 
>>> C:\Python27\python.exe (prefix: C:\Python27)  Traceback 
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\restricted.py", 
>>> line 212, in restricted
>>> exec ccode in environment
>>>   File "C:/Users/MCR/Google 
>>> Drive/loic/web2py/web2py/applications/test/models/db.py" 
>>> , line 101, in 
>>> 
>>> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>>> 7790, in __getattr__
>>> return self.lazy_define_table(tablename,*fields,**args)
>>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>>> 7714, in lazy_define_table
>>> polymodel=polymodel)
>>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>>> 776, in create_table
>>> elif field_type.startswith('reference'):
>>> AttributeError: 'NoneType' object has no attribute 'startswith'
>>>
>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Where did the auth_user table go (v. 2.4.x) that used to be in db.py

2013-04-18 Thread wdtnh
doh!  Totally forgot about this - grthanks!!!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: db._common_fields.append and Lazy_tables

2013-04-18 Thread Loïc
One more question Anthony,
If I have other tables which reference themselves like :

db.define_table('mytable',Field('myfield','string'))
db.define_table('my_other_table',Field('myTable','reference mytable'))

should I replace the* 'reference mytable' *statement with* 'reference %s' % 
I_dont_know_what*' to be "lazy_tables compliant"?
Thank you

Le jeudi 18 avril 2013 13:59:18 UTC+2, Anthony a écrit :
>
> Have the auth tables been defined at that point. In any case, to avoid 
> pre-mature table definition, try replacing auth.settings.table_user with:
>
> 'reference %s' % auth.settings.table_user_name
>
> Anthony
>
> On Thursday, April 18, 2013 7:51:19 AM UTC-4, Loïc wrote:
>>
>> Hello All
>>
>> consider the example model file below :
>>
>> db = DAL('sqlite://storage.sqlite')
>>
>> signature = db.Table(db,'auth_signature',
>>   Field('created_on','datetime',default=request.now,
>> writable=False,readable=False, label=T('Created on')),
>> Field('created_by',auth.settings.table_user,default=auth.user_id,
>> writable=False,readable=False, label=T('Created by')),
>> Field('modified_on','datetime',update=request.now,default=request
>> .now,
>> writable=False,readable=False, label=T('Modified on')),
>>   Field('modified_by',auth.settings.table_user,
>> default=auth.user_id,update=auth.user_id,
>> writable=False,readable=False, label=T('Modified by'))
>>   )
>>
>> db._common_fields.append(signature)
>>
>> db.define_table('mytable',Field('myfield','string'))
>> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>>
>> Then, if I want to activate lazy_tables 
>> db = DAL('sqlite://storage.sqlite', lazy_tables=True)
>>
>> I got the following error that I don't really understand.
>> Can anyone explain me?
>> Thank you 
>>
>> Error ticket for "test" Ticket ID 
>>
>> 127.0.0.1.2013-04-18.13-47-51.4d08ccf5-8d25-4cf1-a8dd-081d76046b7a
>>  'NoneType' object has no attribute 
>> 'startswith' Version  web2py™ Version 
>> 2.4.5-stable+timestamp.2013.03.18.22.46.22  Python Python 2.7.3: 
>> C:\Python27\python.exe (prefix: C:\Python27)  Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> Traceback (most recent call last):
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\restricted.py", 
>> line 212, in restricted
>> exec ccode in environment
>>   File "C:/Users/MCR/Google 
>> Drive/loic/web2py/web2py/applications/test/models/db.py" 
>> , line 101, in 
>> 
>> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>> 7790, in __getattr__
>> return self.lazy_define_table(tablename,*fields,**args)
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>> 7714, in lazy_define_table
>> polymodel=polymodel)
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>> 776, in create_table
>> elif field_type.startswith('reference'):
>> AttributeError: 'NoneType' object has no attribute 'startswith'
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: db._common_fields.append and Lazy_tables

2013-04-18 Thread Loïc
Great!
Thank you Anthony

Le jeudi 18 avril 2013 13:59:18 UTC+2, Anthony a écrit :
>
> Have the auth tables been defined at that point. In any case, to avoid 
> pre-mature table definition, try replacing auth.settings.table_user with:
>
> 'reference %s' % auth.settings.table_user_name
>
> Anthony
>
> On Thursday, April 18, 2013 7:51:19 AM UTC-4, Loïc wrote:
>>
>> Hello All
>>
>> consider the example model file below :
>>
>> db = DAL('sqlite://storage.sqlite')
>>
>> signature = db.Table(db,'auth_signature',
>>   Field('created_on','datetime',default=request.now,
>> writable=False,readable=False, label=T('Created on')),
>> Field('created_by',auth.settings.table_user,default=auth.user_id,
>> writable=False,readable=False, label=T('Created by')),
>> Field('modified_on','datetime',update=request.now,default=request
>> .now,
>> writable=False,readable=False, label=T('Modified on')),
>>   Field('modified_by',auth.settings.table_user,
>> default=auth.user_id,update=auth.user_id,
>> writable=False,readable=False, label=T('Modified by'))
>>   )
>>
>> db._common_fields.append(signature)
>>
>> db.define_table('mytable',Field('myfield','string'))
>> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>>
>> Then, if I want to activate lazy_tables 
>> db = DAL('sqlite://storage.sqlite', lazy_tables=True)
>>
>> I got the following error that I don't really understand.
>> Can anyone explain me?
>> Thank you 
>>
>> Error ticket for "test" Ticket ID 
>>
>> 127.0.0.1.2013-04-18.13-47-51.4d08ccf5-8d25-4cf1-a8dd-081d76046b7a
>>  'NoneType' object has no attribute 
>> 'startswith' Version  web2py™ Version 
>> 2.4.5-stable+timestamp.2013.03.18.22.46.22  Python Python 2.7.3: 
>> C:\Python27\python.exe (prefix: C:\Python27)  Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> Traceback (most recent call last):
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\restricted.py", 
>> line 212, in restricted
>> exec ccode in environment
>>   File "C:/Users/MCR/Google 
>> Drive/loic/web2py/web2py/applications/test/models/db.py" 
>> , line 101, in 
>> 
>> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>> 7790, in __getattr__
>> return self.lazy_define_table(tablename,*fields,**args)
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>> 7714, in lazy_define_table
>> polymodel=polymodel)
>>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
>> 776, in create_table
>> elif field_type.startswith('reference'):
>> AttributeError: 'NoneType' object has no attribute 'startswith'
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: db._common_fields.append and Lazy_tables

2013-04-18 Thread Anthony
Have the auth tables been defined at that point. In any case, to avoid 
pre-mature table definition, try replacing auth.settings.table_user with:

'reference %s' % auth.settings.table_user_name

Anthony

On Thursday, April 18, 2013 7:51:19 AM UTC-4, Loïc wrote:
>
> Hello All
>
> consider the example model file below :
>
> db = DAL('sqlite://storage.sqlite')
>
> signature = db.Table(db,'auth_signature',
>   Field('created_on','datetime',default=request.now,
> writable=False,readable=False, label=T('Created on')),
> Field('created_by',auth.settings.table_user,default=auth.user_id,
> writable=False,readable=False, label=T('Created by')),
> Field('modified_on','datetime',update=request.now,default=request.
> now,
> writable=False,readable=False, label=T('Modified on')),
>   Field('modified_by',auth.settings.table_user,
> default=auth.user_id,update=auth.user_id,
> writable=False,readable=False, label=T('Modified by'))
>   )
>
> db._common_fields.append(signature)
>
> db.define_table('mytable',Field('myfield','string'))
> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>
> Then, if I want to activate lazy_tables 
> db = DAL('sqlite://storage.sqlite', lazy_tables=True)
>
> I got the following error that I don't really understand.
> Can anyone explain me?
> Thank you 
>
> Error ticket for "test" Ticket ID 
>
> 127.0.0.1.2013-04-18.13-47-51.4d08ccf5-8d25-4cf1-a8dd-081d76046b7a
>  'NoneType' object has no attribute 
> 'startswith' Version  web2py™ Version 
> 2.4.5-stable+timestamp.2013.03.18.22.46.22  Python Python 2.7.3: 
> C:\Python27\python.exe (prefix: C:\Python27)  Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
>
> Traceback (most recent call last):
>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\restricted.py", 
> line 212, in restricted
> exec ccode in environment
>   File "C:/Users/MCR/Google 
> Drive/loic/web2py/web2py/applications/test/models/db.py" 
> , line 101, in 
> 
> db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
> 7790, in __getattr__
> return self.lazy_define_table(tablename,*fields,**args)
>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 
> 7714, in lazy_define_table
> polymodel=polymodel)
>   File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 776, 
> in create_table
> elif field_type.startswith('reference'):
> AttributeError: 'NoneType' object has no attribute 'startswith'
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Full text search query

2013-04-18 Thread Anthony
For me, db("rauthor.addressfulltext@@'south & africa'").select() results in 
"SyntaxError: Set: no tables selected" because the query is a string and no 
fields were passed to .select().

Anthony

On Thursday, April 18, 2013 7:46:42 AM UTC-4, Johann Spies wrote:
>
> In psql I can do:
>
> select * from isi.rauthor A
> where 
> A.addressfulltext@@'south & africa'
>
>
> but the following 
>
>  l = db("rauthor.addressfulltext@@'south & africa'").select()
>
> results in 
>
> TypeError: %d format: a number is required, not NoneType
>
>
> Why?
>
> Model:
>
> from gluon.dal import SQLCustomType
> tsv = SQLCustomType( 
> type ='text',
> native='tsvector' )
> ...
>   Field('addressfulltext',type=tsv),
>
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] db._common_fields.append and Lazy_tables

2013-04-18 Thread Loïc
Hello All

consider the example model file below :

db = DAL('sqlite://storage.sqlite')

signature = db.Table(db,'auth_signature',
  Field('created_on','datetime',default=request.now,
writable=False,readable=False, label=T('Created on')),
Field('created_by',auth.settings.table_user,default=auth.user_id,
writable=False,readable=False, label=T('Created by')),
Field('modified_on','datetime',update=request.now,default=request.
now,
writable=False,readable=False, label=T('Modified on')),
  Field('modified_by',auth.settings.table_user,
default=auth.user_id,update=auth.user_id,
writable=False,readable=False, label=T('Modified by'))
  )

db._common_fields.append(signature)

db.define_table('mytable',Field('myfield','string'))
db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())

Then, if I want to activate lazy_tables 
db = DAL('sqlite://storage.sqlite', lazy_tables=True)

I got the following error that I don't really understand.
Can anyone explain me?
Thank you 

Error ticket for "test" Ticket ID 

127.0.0.1.2013-04-18.13-47-51.4d08ccf5-8d25-4cf1-a8dd-081d76046b7a
 'NoneType' object has no attribute 
'startswith' Version  web2py™ Version 
2.4.5-stable+timestamp.2013.03.18.22.46.22  Python Python 2.7.3: 
C:\Python27\python.exe (prefix: C:\Python27)  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.

Traceback (most recent call last):
  File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\restricted.py", line 
212, in restricted
exec ccode in environment
  File "C:/Users/MCR/Google 
Drive/loic/web2py/web2py/applications/test/models/db.py" 
, line 101, in 

db.mytable.myfield.requires = IS_EMPTY_OR(IS_URL())
  File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 7790, 
in __getattr__
return self.lazy_define_table(tablename,*fields,**args)
  File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 7714, 
in lazy_define_table
polymodel=polymodel)
  File "C:\Users\MCR\Google Drive\loic\web2py\web2py\gluon\dal.py", line 776, 
in create_table
elif field_type.startswith('reference'):
AttributeError: 'NoneType' object has no attribute 'startswith'


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Full text search query

2013-04-18 Thread Johann Spies
In psql I can do:

select * from isi.rauthor A
where
A.addressfulltext@@'south & africa'


but the following

 l = db("rauthor.addressfulltext@@'south & africa'").select()

results in

TypeError: %d format: a number is required, not NoneType


Why?

Model:

from gluon.dal import SQLCustomType
tsv = SQLCustomType(
type ='text',
native='tsvector' )
...
  Field('addressfulltext',type=tsv),


Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Google OpenID authentication.

2013-04-18 Thread Jason
Hello,

I'm implementing Google Wallet into my application. The most important 
aspect for me is to allow a Google federated login. I don't want to use 
Janrain because the prices are ridiculous. Are there any examples on how to 
implement this? My Google searches are aren't providing any examples to use 
with Web2Py (I'm not hosting on Google App Engine.)

I've gotten the Google Plus example from Google to work more or less, but 
that requires the user to have a Google Plus account. I'd rather not force 
that.

Thanks

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: DAL select and count strangeness

2013-04-18 Thread Anthony
.select() will extract the table names from both the query and the fields 
passed to .select() -- this is because we allow an empty query, like 
db().select(db.mytable.ALL). However, .count() only extracts the table 
names from the query, not from the "distinct" argument to .count(). Because 
your query is just a string and not a DAL Query object, the DAL can't 
figure out what the table is (and it doesn't attempt to do so by inspecting 
the "distinct" argument).

Rather than building a string query, why don't you generate a regular DAL 
query object? You can join separate queries with the & and | operators.

Anthony

On Thursday, April 18, 2013 12:54:52 AM UTC-4, Stelios Koroneos wrote:
>
> Greetinfs to all.
> I am facing a problem with count on a db that i am using the following to 
> create the query.
>
> class CDRI():
> def __init__(self,cdri_db):
> self.db=cdri_db
> def 
> _generate_querry(self,device_id,date_from=None,date_to=None,source=None,destination=None):
>if not date_from :
>pass
>if not date_to :
>pass
>if source :
>condition_source="src like \'%s\'" % source
>else :
>   condition_source='src<>""'
>
>if destination :
>condition_destination="dst like \'%s\'" % destination
>else :
>   condition_destination='dst<>""'
>
>condition_deviceid="device_id=%s" %device_id
>
>condition=(condition_deviceid+" and "+ condition_source +" 
> and "+ condition_destination )
>
>return condition
>
> 
> def 
> get_calls(self,device_id,date_from=None,date_to=None,source=None,destination=None):
>
>self.querry_rules=self._generate_querry(device_id, 
> date_from, date_to, source, destination)   
>self.rows=self.db(self.querry_rules).select(self.db.CDR.ALL)
>return self.rows
>
> def 
> get_calls_count(self,device_id,date_from=None,date_to=None,source=None,destination=None):
>self.querry=self._generate_querry(device_id, date_from, 
> date_to, source, destination)
>print self.querry
>result=self.db(self.querry).count(self.db.CDR)
>return result 
>
>
>
> if __name__ == '__main__':
> 
> cdri=CDRI(db_cdri)
> rows=cdri.get_calls(device_id='2',source="210%")
> 
> 
> for row in rows:
> print row.id,row.calldate,row.src,row.dst,row.billsec
> 
> print "Total entries found 
> ",cdri.get_calls_count(device_id=2,source="210%")
>
> 
>
>
> What its basically doing is that it prepares the query rules as string 
> (based on a number of parameters) and then feeds it to the DAL select or 
> count
> The query looks like this 
>
> device_id=2 and src like '210%' and dst<>""
>
> and works fine with select
>
> but when i try to do a count i get this
>
> raceback (most recent call last):
>   File 
> "/home/stelios/eclipse/eclipse-3.7.1/plugins/org.python.pydev_2.7.3.2013031601/pysrc/pydevd.py",
>  
> line 1397, in 
> debugger.run(setup['file'], None, None)
>   File 
> "/home/stelios/eclipse/eclipse-3.7.1/plugins/org.python.pydev_2.7.3.2013031601/pysrc/pydevd.py",
>  
> line 1090, in run
> pydev_imports.execfile(file, globals, locals) #execute the script
>   File "/home/stelios/workspace/CDRi/cdri_data.py", line 70, in 
> print "Total entries found 
> ",cdri.get_calls_count(device_id=2,source="210%")
>   File "/home/stelios/workspace/CDRi/cdri_data.py", line 56, in 
> get_calls_count
> result=self.db(str(self.querry)).count(self.db.CDR)
>   File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 9850, in 
> count
> return db._adapter.count(self.query,distinct)
>   File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 1710, in 
> count
> self.execute(self._count(query, distinct))
>   File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 1768, in 
> execute
> return self.log_execute(*a, **b)
>   File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 1762, in 
> log_execute
> ret = self.cursor.execute(*a, **b)
>   File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in 
> execute
> self.errorhandler(self, exc, value)
>   File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35, in 
> defaulterrorhandler
> raise errorclass, errorvalue
> _mysql_exceptions.ProgrammingError: (1064, 'You have an error in your SQL 
> syntax; check the manual that corresponds to your MySQL server version for 
> the right syntax to use near \'WHERE device_id=2 and src like \'210%\' and 
> dst<>""\' at line 1')
>
>
> I traced the problem and found out that the SQL generated does not include 
> the table name

[web2py] DAL select and count strangeness

2013-04-18 Thread Stelios Koroneos
Greetinfs to all.
I am facing a problem with count on a db that i am using the following to 
create the query.

class CDRI():
def __init__(self,cdri_db):
self.db=cdri_db
def 
_generate_querry(self,device_id,date_from=None,date_to=None,source=None,destination=None):
   if not date_from :
   pass
   if not date_to :
   pass
   if source :
   condition_source="src like \'%s\'" % source
   else :
  condition_source='src<>""'

   if destination :
   condition_destination="dst like \'%s\'" % destination
   else :
  condition_destination='dst<>""'

   condition_deviceid="device_id=%s" %device_id
   
   condition=(condition_deviceid+" and "+ condition_source +" 
and "+ condition_destination )

   return condition
   

def 
get_calls(self,device_id,date_from=None,date_to=None,source=None,destination=None):
   
   self.querry_rules=self._generate_querry(device_id, 
date_from, date_to, source, destination)   
   self.rows=self.db(self.querry_rules).select(self.db.CDR.ALL)
   return self.rows
   
def 
get_calls_count(self,device_id,date_from=None,date_to=None,source=None,destination=None):
   self.querry=self._generate_querry(device_id, date_from, 
date_to, source, destination)
   print self.querry
   result=self.db(self.querry).count(self.db.CDR)
   return result 
   
   
   
if __name__ == '__main__':

cdri=CDRI(db_cdri)
rows=cdri.get_calls(device_id='2',source="210%")


for row in rows:
print row.id,row.calldate,row.src,row.dst,row.billsec

print "Total entries found 
",cdri.get_calls_count(device_id=2,source="210%")




What its basically doing is that it prepares the query rules as string 
(based on a number of parameters) and then feeds it to the DAL select or 
count
The query looks like this 

device_id=2 and src like '210%' and dst<>""

and works fine with select

but when i try to do a count i get this

raceback (most recent call last):
  File 
"/home/stelios/eclipse/eclipse-3.7.1/plugins/org.python.pydev_2.7.3.2013031601/pysrc/pydevd.py",
 
line 1397, in 
debugger.run(setup['file'], None, None)
  File 
"/home/stelios/eclipse/eclipse-3.7.1/plugins/org.python.pydev_2.7.3.2013031601/pysrc/pydevd.py",
 
line 1090, in run
pydev_imports.execfile(file, globals, locals) #execute the script
  File "/home/stelios/workspace/CDRi/cdri_data.py", line 70, in 
print "Total entries found 
",cdri.get_calls_count(device_id=2,source="210%")
  File "/home/stelios/workspace/CDRi/cdri_data.py", line 56, in 
get_calls_count
result=self.db(str(self.querry)).count(self.db.CDR)
  File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 9850, in 
count
return db._adapter.count(self.query,distinct)
  File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 1710, in 
count
self.execute(self._count(query, distinct))
  File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 1768, in 
execute
return self.log_execute(*a, **b)
  File "/home/stelios/workspace/CDRi/web2py/gluon/dal.py", line 1762, in 
log_execute
ret = self.cursor.execute(*a, **b)
  File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in 
execute
self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35, in 
defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, 'You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for 
the right syntax to use near \'WHERE device_id=2 and src like \'210%\' and 
dst<>""\' at line 1')


I traced the problem and found out that the SQL generated does not include 
the table name in the count

I was under the impression that both select,count etc could operate with 
the same "prepared" query.
If this is not a bug what is the appropriate way to handle such a case ?

Thanks for your time


Stelios

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Using SQLFORM.grid with large datasets

2013-04-18 Thread Niphlod
the count affects only the grid for "pagination" purposes. There's no other 
reason to do a count to display a grid.
This means that if you pass cache_count=10, you'll end up not having any 
"1,2,3" links at the bottom to fetch the next "page" of results.
Putting that aside, you can pass whatever "thingy" you fit appropriate for 
the job (fixed int, cache tuple, custom code).

On Thursday, April 18, 2013 11:26:20 AM UTC+2, Johann Spies wrote:
>
> Thanks. 
>
> I will test your suggestions.
>
> I am currently working with Postgresql 9.1 and it takes nearly 5 minutes 
> to count a table > 42 000 000 records.
>
> It will if we can have the option in the grid to not do a count of the 
> result as it is part of the problem in my case.  If for instance the query 
> is db.table.id > 0  I would prefer to use the other way to get an 
> approximate of the total records in the table.
>
>
> If a query would request more records than the total in the table, 
> postgresql would not have a problem.
>
> e.g.  in a table with 15 entries I have tested a query with 'limit 15 
> offset 10' and there was no problem.  Only last 5 records were shown.
>
> Regards
> Johann
>
>
> On 17 April 2013 23:28, Niphlod > wrote:
>
>> check trunk as soon as the Pull Request gets merged
>>
>>
>> def test3(dbset, request_vars):
>> ##you can retrieve the current query with
>> ##dbset._select(), i.e. dbset is a "db(query)" object
>> 
>> ##request_vars are the current request.vars
>> ###so you can check for keywods etc etc etc
>> ###checking for groupby, distinct, etc is up to you!
>> 
>> ##given that is a callable you may cache it "externally"
>> ## with a return dbset.count(cache=(cache.ram, 60))
>> ## and do all your crazy things
>> 
>> ## method that works on postgresql only for a full-table-count
>> result = db.executesql("SELECT reltuples::integer FROM pg_class 
>> WHERE oid = 'public.awesome'::regclass;")
>> return result[0][0]
>>
>> def test2():
>> #mode1
>> cache_count = 127
>> #mode2
>> cache_count = (cache.ram, 60)
>> #mode3
>> cache_count = test3
>> grid = SQLFORM.grid(db.awesome, cache_count=cache_count)
>> return dict(grid=grid)
>>
>>
>> Can I leave documentation up to someone willing to test it and report 
>> back ? :P
>>
>>
>> PS: fixed 8 hours later.web2py is 
>> awesome
>>
>> PS2: on a test table with 4M rows, two 'string' fields, postgresql 9.2 
>> takes 1.9sec to do a "standard" count(*). 
>> Things definitely improved (although it remains a heavy operation for 
>> MVCC databases) on the count(*) since previous versions.
>>
>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Return value from javascript to controller

2013-04-18 Thread Niphlod
that seems more a problem with the format of the date than the fact that it 
has to be "timezone-normalized"what language translation are you using ?

PS: what I meant with "landing page" is that you're sure that the user will 
hit that page before arriving to the form.
If you are sure, there's no need to embed the LOADed fragment in the form 
page

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Using SQLFORM.grid with large datasets

2013-04-18 Thread Johann Spies
Thanks.

I will test your suggestions.

I am currently working with Postgresql 9.1 and it takes nearly 5 minutes to
count a table > 42 000 000 records.

It will if we can have the option in the grid to not do a count of the
result as it is part of the problem in my case.  If for instance the query
is db.table.id > 0  I would prefer to use the other way to get an
approximate of the total records in the table.


If a query would request more records than the total in the table,
postgresql would not have a problem.

e.g.  in a table with 15 entries I have tested a query with 'limit 15
offset 10' and there was no problem.  Only last 5 records were shown.

Regards
Johann


On 17 April 2013 23:28, Niphlod  wrote:

> check trunk as soon as the Pull Request gets merged
>
>
> def test3(dbset, request_vars):
> ##you can retrieve the current query with
> ##dbset._select(), i.e. dbset is a "db(query)" object
>
> ##request_vars are the current request.vars
> ###so you can check for keywods etc etc etc
> ###checking for groupby, distinct, etc is up to you!
>
> ##given that is a callable you may cache it "externally"
> ## with a return dbset.count(cache=(cache.ram, 60))
> ## and do all your crazy things
>
> ## method that works on postgresql only for a full-table-count
> result = db.executesql("SELECT reltuples::integer FROM pg_class WHERE
> oid = 'public.awesome'::regclass;")
> return result[0][0]
>
> def test2():
> #mode1
> cache_count = 127
> #mode2
> cache_count = (cache.ram, 60)
> #mode3
> cache_count = test3
> grid = SQLFORM.grid(db.awesome, cache_count=cache_count)
> return dict(grid=grid)
>
>
> Can I leave documentation up to someone willing to test it and report back
> ? :P
>
>
> PS: fixed 8 hours later.web2py is
> awesome
>
> PS2: on a test table with 4M rows, two 'string' fields, postgresql 9.2
> takes 1.9sec to do a "standard" count(*).
> Things definitely improved (although it remains a heavy operation for MVCC
> databases) on the count(*) since previous versions.
>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Python Redis Queue

2013-04-18 Thread Ricardo Pedroso
Now I remember seeing that thread, at the time I was with other things
and end up forget it.

I will see, later tonight or maybe this afternoon, what I can do about
queueing functions in models.




On Thu, Apr 18, 2013 at 10:03 AM, Niphlod  wrote:
> here ... https://groups.google.com/d/msg/web2py/js0VAKK6Dlw/CJ46I-0wT0wJ
>
> That is what you more or less described.
>
> if this works out in rq "linearly" I'll cross out "port web2py's scheduler
> to redis" from the todo list (it will be a nice project though) :P
>
> rq has the "react fast" juice but doesn't carry on some of the niceties of
> the internal scheduler.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] display logo pic in header top

2013-04-18 Thread Johann Spies
Apologies, I misread your mail. Niphlod's  answer is the correct one for
your purposes.


On 18 April 2013 11:11, Johann Spies  wrote:

> I have the following in models/0.py:
>
> settings.title =CENTER(IMG(_src=URL('static','images/us_crest_comb.png'),
> _style="height:120px; width:auto;",
>_alt=T('US-Crest-logo')))
>
> and in menu.py:
> response.title = settings.title
>
> Read the file views/layout.html to figure out how the graphical layout
> works.
>
> Regards
> Johann
>
>
>
> On 18 April 2013 10:59, Karl Thomas Schmidt <
> karl.thomas.schm...@googlemail.com> wrote:
>
>> Hi@all,
>>
>> I tried to display an image within the top fixed header menu.
>> All I can get is to display the  text.
>> How to do that?
>>
>> Is there a kind of tutorial explaining how the graphical layout works?
>> Where can I read about that?
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] display logo pic in header top

2013-04-18 Thread Johann Spies
I have the following in models/0.py:

settings.title =CENTER(IMG(_src=URL('static','images/us_crest_comb.png'),
_style="height:120px; width:auto;",
   _alt=T('US-Crest-logo')))

and in menu.py:
response.title = settings.title

Read the file views/layout.html to figure out how the graphical layout
works.

Regards
Johann



On 18 April 2013 10:59, Karl Thomas Schmidt <
karl.thomas.schm...@googlemail.com> wrote:

> Hi@all,
>
> I tried to display an image within the top fixed header menu.
> All I can get is to display the  text.
> How to do that?
>
> Is there a kind of tutorial explaining how the graphical layout works?
> Where can I read about that?
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: display logo pic in header top

2013-04-18 Thread Niphlod
if you're using the scaffolding app then set response.logo accordingly

by default is 

response.logo = A(B('web',SPAN(2),'py'),XML('™ '),
  _class="brand",_href="http://www.web2py.com/";)

replace, e.g., the B() element with an IMG() one and you're good to go.

On Thursday, April 18, 2013 10:59:52 AM UTC+2, Karl Thomas Schmidt wrote:
>
> Hi@all, 
>
> I tried to display an image within the top fixed header menu. 
> All I can get is to display the  text. 
> How to do that? 
>
> Is there a kind of tutorial explaining how the graphical layout works? 
> Where can I read about that? 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Python Redis Queue

2013-04-18 Thread Niphlod
here ... https://groups.google.com/d/msg/web2py/js0VAKK6Dlw/CJ46I-0wT0wJ

That is what you more or less described.

if this works out in rq "linearly" I'll cross out "port web2py's scheduler 
to redis" from the todo list (it will be a nice project though) :P

rq has the "react fast" juice but doesn't carry on some of the niceties of 
the internal scheduler.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] display logo pic in header top

2013-04-18 Thread Karl Thomas Schmidt
Hi@all,

I tried to display an image within the top fixed header menu.
All I can get is to display the  text.
How to do that?

Is there a kind of tutorial explaining how the graphical layout works?
Where can I read about that?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Python Redis Queue

2013-04-18 Thread Ricardo Pedroso
On Wed, Apr 17, 2013 at 5:25 PM, Niphlod  wrote:
> does this work when queueing, e.g. a function defined in models ?

No and 
 maybe yes if you make your enqueue method that will submit the
function defined in a model, but under the hood it will run a predefined method
in a helper module that will accept as an argument a function defined in the
model, starts a web2py environment with run_models_in and then call that
model function.

Dont know if I was clear... but I can try this later tonight.

> Last time I checked all my "jobs" needed to be in a separate modulemaybe

Still true.

> the method used to implement the same thing with celery can be used for
> that.

What is this method?


Ricardo


> On Wednesday, April 17, 2013 6:03:40 PM UTC+2, Ricardo Pedroso wrote:
>>
>> On Tue, Apr 16, 2013 at 12:26 AM, Tito Garrido  wrote:
>> >  Nice! Is it working? Is there an example of application?
>>
>> I just put on github one example (https://github.com/rpedroso/rqdboard).
>> It has the rq-dashboard (https://github.com/nvie/rq-dashboard)
>> "ported" to web2py.
>>
>> Ricardo
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: list:string type field output format

2013-04-18 Thread 黄祥
yes, you are right, my mistake, the problem is on the data itself, because 
i input it via populate.
thank you so much for your hints and suggestions

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Old DAL bug (?) ValueError: invalid literal for int() with base 10: 'AssetTypes\\Character.png'

2013-04-18 Thread Arnon Marcus
Can somebody pleas respond?

We are quite desperate here about this...

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: REF: Component + Javascript

2013-04-18 Thread Teddy Nyambe
Ok let me start simple see where i get. Will share what i get


On Thu, Apr 18, 2013 at 9:34 AM, Niphlod  wrote:

> you can't load a html fragment "at wish". The second LOAD is found, it
> triggers the loading: it's not the way to do it.
>
> Still, until you can't find out why you can't attach an event to your
> button, all the remains of the discussion is useless: let's start simple
> (single button in the page), then go all the way up to your grid, finding
> where your event gets "not fired".
>
>
> On Thursday, April 18, 2013 7:48:37 AM UTC+2, software.ted wrote:
>
>> The button has a href="#mymodal" calling a modal window. What I want is
>> to pass an ID to the modal window. I have a LOAD() in the modal window. so
>> in essence the situation is i have a grid listing with each row a button,
>> then click a button calls a modal window which has a > id="mp_xx">{{=LOAD('c','a', args='x')}}. Now when a user clicks on
>> the button i want to change the contents of the div using
>> jQuery('#id_xx').html("{{=**LOAD('c','a', args=var)}}"). Maybe there is
>> another way of doing this??? Please advise.
>>
>>
>> On Wed, Apr 17, 2013 at 2:18 PM, Niphlod  wrote:
>>
>>> are you sure that the button has not yet an event attached that prevents
>>> your "custom" one ?
>>>
>>>
>>> On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:
>>>
 I have a component am loading in a 
 
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'),
 target='setting-content')}}

 

  

 in this same view page i have a 

 
   jQuery('#mp_257').click(**functi**on(){
 jQuery('#test').html('Test')
 //alert("Test")
   })
 

 The component has a button with an id=mp_257, but when i click on it,
 jQuery in the view above is not being executed by replacing the "Text" in
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details',
 _id = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view
 using:

 {{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id =
 'mp_257', _class='btn')}}

 All works fine, is there something about loaded component that prevents
 running of javascript in the same page?

 --
 ....
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> ..**..**
>> ...
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is
>> all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: list:string type field output format

2013-04-18 Thread Niphlod
check again: there's no way mine and Anthony's last snippets generates a 
single A holding two addresses

On Thursday, April 18, 2013 4:04:26 AM UTC+2, 黄祥 wrote:
>
> thank you so much for your hints niphlod and anthony, i've tried both of 
> your hints, but the result is not what i'm expected (no error occured)
> {{=SPAN(T('Email : '), XML(', '.join([A(email, _title=T('Send Email'), 
> _target='_blank',
>_href='mailto:%s' % email).xml() for email in row.email])), 
> _id='email_%s' % i)}}
>
> {{=SPAN(T('Email : '), CAT([A(email, _title=T('Send Email'), 
> _target='_blank',
>_href='mailto:%s' % email) for email in row.email]), _id='email_%s' 
> % i)}}
>
> the result in inspect elements :
> mailto:a...@a.com , b...@b.com " 
> target="_blank" title="Send Email">a...@a.com , 
> b...@b.com
> 
>
> my expectation is
> mailto:a...@a.com " target="_blank" title="Send 
> Email">a...@a.com 
> , 
> mailto:b...@b.com " target="_blank" title="Send 
> Email">b...@b.com 
>
> any idea how to accomplish it?
> thank you so much in advance
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: REF: Component + Javascript

2013-04-18 Thread Niphlod
you can't load a html fragment "at wish". The second LOAD is found, it 
triggers the loading: it's not the way to do it.

Still, until you can't find out why you can't attach an event to your 
button, all the remains of the discussion is useless: let's start simple 
(single button in the page), then go all the way up to your grid, finding 
where your event gets "not fired".

On Thursday, April 18, 2013 7:48:37 AM UTC+2, software.ted wrote:
>
> The button has a href="#mymodal" calling a modal window. What I want is to 
> pass an ID to the modal window. I have a LOAD() in the modal window. so in 
> essence the situation is i have a grid listing with each row a button, then 
> click a button calls a modal window which has a  id="mp_xx">{{=LOAD('c','a', args='x')}}. Now when a user clicks on 
> the button i want to change the contents of the div using 
> jQuery('#id_xx').html("{{=LOAD('c','a', args=var)}}"). Maybe there is 
> another way of doing this??? Please advise.
>
>
> On Wed, Apr 17, 2013 at 2:18 PM, Niphlod  >wrote:
>
>> are you sure that the button has not yet an event attached that prevents 
>> your "custom" one ?
>>
>>
>> On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:
>>
>>> I have a component am loading in a 
>>> 
>>> {{=A('Link to comp', component=URL('research', 'mycomponent.load'), 
>>> target='setting-content')}}
>>>
>>> 
>>>
>>>  
>>>
>>> in this same view page i have a 
>>>
>>> 
>>>   jQuery('#mp_257').click(**function(){
>>> jQuery('#test').html('Test')
>>> //alert("Test")
>>>   })
>>> 
>>>
>>> The component has a button with an id=mp_257, but when i click on it, 
>>> jQuery in the view above is not being executed by replacing the "Text" in 
>>> the div...the component has a grid with a custom button created as follows:
>>>
>>> links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details', 
>>> _id = 'mp_257', _class='btn')]
>>>
>>> Anything why this is not working? But when I put the button in the view 
>>> using:
>>>
>>> {{=A(SPAN(_class='icon-pencil'**), 'Personal Details', _id = 'mp_257', 
>>> _class='btn')}}
>>>
>>> All works fine, is there something about loaded component that prevents 
>>> running of javascript in the same page?
>>>
>>> -- 
>>> ..**..**
>>> ...
>>> Teddy Lubasi Nyambe
>>> Opensource Zambia
>>> Lusaka, ZAMBIA
>>>
>>> Cell: +260 97 7760473
>>> website: http://www.opensource.org.zm
>>>
>>> ~/
>>> Human Knowledge belongs to the world! - AntiTrust
>>>
>>> Man is a tool-using animal. Without tools he is nothing, with tools he 
>>> is all - Thomas Carlyle 1795-1881
>>>
>>> /~ 
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
>
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.