Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-07-06 Thread Ricardo Pedroso
On Fri, Jul 4, 2014 at 10:37 AM, Gideon George 
wrote:

I want to create an awesome rss feed agregator like that of techi.com
> please is there any example of site that did it in web2py? Also I need
> suggestions on how to go about it.
> Thank you
>
>
>
I have my own personal feed agregator done in web2py. It's not an "awesome"
one but my
requirements were to not have images and to not have any javascript.
I want it to be fast and functional.
I currently have the load event and domcontentloaded event in chomium fired
in less than 400ms.
You can see it here: http://feeds.uni.me

from memory my setup is:

- nginx with uwsgi protocol, but not with uWSGI server. I implemented a
subset of
uwsgi protocol in pure python to be able to use eventlet (I think uWSGI
server doesn't support eventlet).

- sessions and cache are stored in redis.

- sqlite database. Currently it has near 30 (~665Mb) articles in it.
One thing I learn is that sqlite is very slow to "select count(*) from
table",
I was using this query for pagination with pages,
than I change to only newer, older buttons to avoid the count(*).

- search is powered by whoosh and bottle - Web2py is querying through a
simple restful api.
I have 2 separated whoosh indexes, one for portuguese articles and the
other for english.

- a background job to collect and process the feeds,  than the feeds are
stored in sqlite and added to
whoosh index.

- perp (http://b0llix.net/perp/ - similar to daemontools) to control all
the pieces

- a small VPS with 256Mb of RAM.


Ricardo

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Using whoosh with web2py

2014-07-06 Thread lokesh
I'm using whoosh backend with plugin_haystack in my application.
But the search function is working only if there is an insert or update db 
statement in that function.
For instance :
def temp():
 db.my_table.insert(my_row1="temporary data to test the search")
 rows = db(index.search(my_row1="data to search"))
 return dict(rows=rows)
this returns the newly inserted row as the search result. But after that if 
I do this, it doesn't return any matching result,
def temp2():
 rows = db(index.search(my_row1="data to search"))
 return dict(rows=rows)
what could be the mistake here?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Implementing a search engine in web2py

2014-07-06 Thread lokesh
I'm using whoosh backend with plugin_haystack in my application.
But the search function is working only if there is an insert or update db 
statement in that function.
For instance :
def temp():
 db.my_table.insert(my_row1="temporary data to test the search")
 rows = db(index.search(my_row1="data to search"))
 return dict(rows=rows)

this returns the newly inserted row as the search result. But after that if 
I do this, it doesn't return any matching result,
def temp2():
 rows = db(index.search(my_row1="data to search"))
 return dict(rows=rows)

what could be the mistake here?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: MySQL - OperationalError: Error on rename (errno: 150)

2014-07-06 Thread José Antonio Salazar Montenegro
I realize this is an ancient topic, but I'm having the very same error 
migrating a MySQL table where I'm only removing a self reference field.

It seems like an index was created to guard the (self) foreign-key 
constraint and DAL doesn't remove it when deleting the field.
There are no manually-created indexes on my database, all were created 
automatically.

Just wondering if this was fixed.

On Monday, July 20, 2009 12:05:44 PM UTC-5, David Zejda wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hello,
>
> my db backend is MySQL 5.0.51a-24 on Linux.
>
> If I try to gently alter already generated table schema, like to rename
>
> SQLField('relation', 'text', requires = \
>IS_NULL_OR(IS_IN_DB(db, 'relation_type.id', 'relation_type.id',
> multiple=True)))
>
> to
>
> SQLField('relation_type', 'text', requires = \
>IS_NULL_OR(IS_IN_DB(db, 'relation_type.id', 'relation_type.id',
> multiple=True)))
>
> i get this:
>
> Traceback (most recent call last):
>   File "/home/zejdad/!a/jfind/web2py/gluon/restricted.py", line 98, in
> restricted
> exec ccode in environment
>   File "/home/zejdad/!a/jfind/web2py/applications/jfind/models/db.py",
> line 346, in 
> migrate="person"
>   File "/home/zejdad/!a/jfind/web2py/gluon/sql.py", line 938, in
> define_table
> raise e
> OperationalError: (1025, "Error on rename of './jfind/#sql-ac1_5e' to
> './jfind/person' (errno: 150)")
>
> Maybe, it is related to the troubles mentioned there:
>
> http://forums.mysql.com/read.php?22,95361
>
> Please, do you have any experiences with a such type of errors?
>
> I would like to test it with MyISAM instead of InnoDB tables, but it is
> not easy to change it in already generated and interrelated tables:
>
> ALTER TABLE `person` ENGINE = MYISAM
>
> #1217 - Cannot delete or update a parent row: a foreign key constraint
> fails
>
> Or should I try other MySQL version?
>
> Thank you for advices!
>
> David
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkpko+cACgkQ3oCkkciamVF3nACfdej9+FBUseSRBgMtJyBm0elR
> wKUAnjx/qSTnNzG+Dr47AKmHm40PxJUK
> =HqDy
> -END PGP SIGNATURE-
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: how to disable "register" item from the default upper right-hand side dropdown

2014-07-06 Thread Alex Glaros

>
> Thanks Anthony,
>

"Register" now doesn't appear in dropdown, but can you simplify description 
of what functionality is lost?  If the "register" action is needed, how can 
it be restored while still suppressing the word "register" in the dropdown?

 If that is not possible, where an how can dropdown link be redirected to 
my own custom registration form? (Different types of users have different 
registration forms, e.g., citizen has one, government organization has 
another, NGO, has another registration form.)

thanks

Alex

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: APNSFeedbackWrapper receive method freezes

2014-07-06 Thread Leonel Câmara
I have used PyAPNS https://github.com/simonwhitaker/PyAPNs for this with 
some degree of success in the past.

What I do is to send the notifications 1 by 1 which is quite slow but at 
least you can catch invalid tokens. This is the relevant part of the code I 
use:

for device in ios_devices:
try:
apns.gateway_server.send_notification(device, payload)
except socket.error as e:
# Most likely cause of a broken pipe is this token being 
invalid! (maybe the user uninstalled)
apns = APNs(use_sandbox=False, cert_file=cert, key_file=key)
logger.debug('SOCKET ERROR - ' + str(e.errno) + ' deleting ' + 
device)
db((db.push_devices.platform == 'ios') & 
(db.push_devices.device_id_or_token == device)).delete()
continue

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


Re: [web2py] SQLEDITABLE plugin

2014-07-06 Thread Fabiano Almeida
Hi kato!

How to use SQLEDITABLE with a query?

If I try this in your first example:

query = db.employee_sheet.resigned == True
editable = SQLEDITABLE(query, showid=False, maxrow=5).process()

Return error:


AttributeError: 'Query' object has no attribute '_id'

How to filter table?

Thanks,

Fabiano



2014-07-01 10:12 GMT-03:00 'kato' via web2py-users 
:

> Hi.
>
> I tried to make SQLEDITABLE plugin.
>
> demo-page: http://docs1.erp2py.com/sqleditable/demo/demo_en.html
>
> It is similar as gluon/contrib/spreadsheet. But, it is easy to use more.
> If you are interested, please try.
>
> Thanks.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received 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/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: how to disable "register" item from the default upper right-hand side dropdown

2014-07-06 Thread Anthony
I believe you should still be able to create a registration form explicitly 
via auth.register() (though please try it to confirm). However, if you use 
something like the default user action:

def user():
return dict(form=auth())

and call it with a URL like /myapp/default/user/register, it will not 
generate a register form (because the register action was disabled).

Anthony

On Sunday, July 6, 2014 3:02:48 AM UTC-4, Alex Glaros wrote:
>
> Thanks Anthony,
>>
>
> "Register" now doesn't appear in dropdown, but can you simplify 
> description of what functionality is lost?  If the "register" action is 
> needed, how can it be restored while still suppressing the word "register" 
> in the dropdown?
>
>  If that is not possible, where an how can dropdown link be redirected to 
> my own custom registration form? (Different types of users have different 
> registration forms, e.g., citizen has one, government organization has 
> another, NGO, has another registration form.)
>
> thanks
>
> Alex
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: APNSFeedbackWrapper receive method freezes

2014-07-06 Thread Wonton
Hi Leonel,

Thank you for your answer.

While I was waiting for an answer to my problem I implemented a solution 
very similar to yours. But I have that code (similar to yours) inside a 
thread to avoid its slow performance.

The problem is, as I tell here, in other post 
(https://groups.google.com/forum/#!topic/web2py/LIO5xU3pjyM), that I don't 
know how to use DAL inside a thread because I always get crashes or errors 
due to closed connections in main thread.

So, I will need to know how to use DAL inside a thread or to know how to 
use feedback class of APNSWrapper.

Thanks again and kind regards!

On Sunday, July 6, 2014 8:05:08 PM UTC+2, Leonel Câmara wrote:
>
> I have used PyAPNS https://github.com/simonwhitaker/PyAPNs for this with 
> some degree of success in the past.
>
> What I do is to send the notifications 1 by 1 which is quite slow but at 
> least you can catch invalid tokens. This is the relevant part of the code I 
> use:
>
> for device in ios_devices:
> try:
> apns.gateway_server.send_notification(device, payload)
> except socket.error as e:
> # Most likely cause of a broken pipe is this token being 
> invalid! (maybe the user uninstalled)
> apns = APNs(use_sandbox=False, cert_file=cert, key_file=key)
> logger.debug('SOCKET ERROR - ' + str(e.errno) + ' deleting ' + 
> device)
> db((db.push_devices.platform == 'ios') & 
> (db.push_devices.device_id_or_token == device)).delete()
> continue
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: APNSFeedbackWrapper receive method freezes

2014-07-06 Thread Leonel Câmara
You can use the included web2py scheduler instead of using your own threads 
to do what you want. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: APNSFeedbackWrapper receive method freezes

2014-07-06 Thread Wonton
I'll study this. But, could I use DAL inside the scheduler and work with my 
database without errors as I have working with threads?

Thank you!

On Sunday, July 6, 2014 11:47:02 PM UTC+2, Leonel Câmara wrote:
>
> You can use the included web2py scheduler instead of using your own 
> threads to do what you want. 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-07-06 Thread Massimo Di Pierro
Nice!

On Sunday, 6 July 2014 02:01:23 UTC-5, Ricardo Pedroso wrote:
>
> On Fri, Jul 4, 2014 at 10:37 AM, Gideon George  
> wrote:
>
> I want to create an awesome rss feed agregator like that of techi.com
>> please is there any example of site that did it in web2py? Also I need 
>> suggestions on how to go about it.
>> Thank you
>>
>>
>>
> I have my own personal feed agregator done in web2py. It's not an 
> "awesome" one but my
> requirements were to not have images and to not have any javascript.
> I want it to be fast and functional.
> I currently have the load event and domcontentloaded event in chomium 
> fired in less than 400ms.
> You can see it here: http://feeds.uni.me
>
> from memory my setup is:
>
> - nginx with uwsgi protocol, but not with uWSGI server. I implemented a 
> subset of
> uwsgi protocol in pure python to be able to use eventlet (I think uWSGI 
> server doesn't support eventlet).
>
> - sessions and cache are stored in redis.
>
> - sqlite database. Currently it has near 30 (~665Mb) articles in it.
> One thing I learn is that sqlite is very slow to "select count(*) from 
> table",
> I was using this query for pagination with pages,
> than I change to only newer, older buttons to avoid the count(*).
>
> - search is powered by whoosh and bottle - Web2py is querying through a 
> simple restful api.
> I have 2 separated whoosh indexes, one for portuguese articles and the 
> other for english.
>
> - a background job to collect and process the feeds,  than the feeds are 
> stored in sqlite and added to
> whoosh index.
>
> - perp (http://b0llix.net/perp/ - similar to daemontools) to control all 
> the pieces
>
> - a small VPS with 256Mb of RAM.
>
>
> Ricardo
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


Re: [web2py] Re: tip of the day. The power of routes

2014-07-06 Thread Nguyen Minh Tuan
Hi Lyn2py, can you send your script?


On 5 July 2014 14:33, lyn2py  wrote:

> Hi Tuan,
>
> I tried the change (line in red) but it couldn't route to my app properly.
> I'm not familiar with the regex routes, so I'm using it as-is. I don't know
> how to troubleshoot this.
>
>
>
> On Friday, July 4, 2014 9:59:37 AM UTC+8, Nguyen Minh Tuan wrote:
>
>> Hi Massimo,
>>
>> Lyn2py posted above is that issue I met, I post complete script :
>> (I mark the only one line I changed with red color)
>>
>> -- routes.py ---
>> config = '''
>> site1.com.vn /hhp/default
>> site2.com.vn /welcome/default
>> '''
>>
>> def auto_in(apps):
>> routes = [
>> ('/admin$anything', '/admin$anything'),
>> ]
>> for domain, path in [x.strip().split() for x in apps.split('\n') if
>> x.strip() and not x.strip().startswith('#')]:
>> if not path.startswith('/'):
>> path = '/' + path
>> if path.endswith('/'):
>> path = path[:-1]
>> app = path.split('/')[1]
>> routes += [
>> ('.*:https?://(.*\.)?%s:$method /' % domain, '%s' % path),
>> ('.*:https?://(.*\.)?%s:$method /static/$anything' % domain,
>> '/%s/static/$anything' % app),
>> ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' %
>> domain, '/%s/appadmin/$anything' % app),
>> ('.*:https?://(.*\.)?%s:$method /%s/$anything' % (domain,
>> app), '/%s/$anything' % app)
>> ]
>> return routes
>>
>>
>> def auto_out(apps):
>> routes = []
>> for domain, path in [x.strip().split() for x in apps.split('\n') if
>> x.strip() and not x.strip().startswith('#')]:
>> if not path.startswith('/'):
>> path = '/' + path
>> if path.endswith('/'):
>> path = path[:-1]
>> app = path.split('/')[1]
>> routes += [
>> ('/%s/static/$anything' % app, '/static/$anything'),
>> ('/%s/appadmin/$anything' % app, '/appadmin/$anything'),
>> ('/%s/$anything' % path, '/$anything')
>> ]
>> return routes
>>
>> routes_in = auto_in(config)
>> routes_out = auto_out(config)
>> ---
>>
>> Regards,
>> Tuan.
>>
>>
>> On 3 July 2014 21:51, Massimo Di Pierro  wrote:
>>
>>> There is nothing "default" specific in the script. Something else must
>>> be the problem.
>>>
>>>
>>> On Thursday, 3 July 2014 07:04:44 UTC-5, lyn2py wrote:

 I have a question for anyone using this… I realized that it only works
 for redirects to the functions within default.py. If I setup another
 controller, it can't route to that controller. Is this the intended
 behaviour? How can I include other controllers without having to add one
 controller for every line? Thanks :)

>>>  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received 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/8KxcHTRIBWU/unsubscribe.
>>> 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/d/optout.
>>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received 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/8KxcHTRIBWU/unsubscribe.
> 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/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


Re: [web2py] Can I create an RSS Reader like Techi in web2py?

2014-07-06 Thread Vinicius Assef
Ricardo, very nice your solution.

Below, I wrote some questions about it.

>
> On Sunday, 6 July 2014 02:01:23 UTC-5, Ricardo Pedroso wrote:
>>
>> - search is powered by whoosh and bottle - Web2py is querying through a
>> simple restful api.

I was thinking about this piece of your architecture.
If your request goes through Web2py, why delegate search to bottle?
(and, also, wait for another request)

Why not just using Whoosh inside Web2py?

>>
>> - a small VPS with 256Mb of RAM.

All these described processes run inside this vps?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.


[web2py] Re: Ractive.js

2014-07-06 Thread Stefan Scholl
eric cuver  wrote:
> My eyes struck Ractive.js and I want to test it with Web2py. Web2py however 
> uses also {{ }} as the templating characters. Ractive uses these characters 
> also. how i Can be done ?

These are handlebars templates, am I right?

Put them in separate files and make a raw include.

https://groups.google.com/forum/#!topic/web2py/WnPAD-nwKyQ



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received 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/d/optout.