Ramkrishan Bhatt | 2 Mar 02:06 2015
Picon

ImportError: No module named duplicity.tarfile

HIi Everyone,
After deploying in the server i got this issue. 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
naveed | 2 Mar 01:36 2015
Picon

Problems after upgrading to 2.9.12

I was running a version 2.8.x without any trouble except that the forgot email feature was not working. I upgraded to 2.9.12 and my index page is being rendered as text (the source is being displayed on the browser). The content-type is showing up as json instead of html. I made NO changes to the application in months. After manually setting

response.headers['Content-Type'] = 'text/html'

in the index controller, the page renders correctly as HTML. But an ajax response that was returning JSON is failing on both Chrome and Firefox. Firefox shows a this error message:

SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data

Upon further investigation, it appears that the return is now actually JSON and it wasn't earlier, the content-type is JSON now. Something's changed with the content-type and is breaking previously working applications.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Alex Glaros | 1 Mar 22:50 2015
Picon

"belongs" statement for grid

get this error

Query Not Supported: no such column: BlockedConnection.blockingPerson

when trying to exclude "blocked" people in social network app

doNotDisplayThisPersonQuery = ((db.auth_user.id == db.BlockedConnection.blockingPerson) & (db.BlockedConnection.blockedPerson == auth.user_id))

query = ~db.auth_user.id.belongs([doNotDisplayThisPersonQuery])

grid = SQLFORM.grid(query, fields=[db.BlockedConnection.blockingPerson, db.BlockedConnection.blockedPerson, db.auth_user.first_name, db.auth_user.last_name, db.auth_user.personMiddleName, db.auth_user.currentPosition, db.auth_user.summarySelfDescription, db.auth_user.keyWords])

any ideas on how to fix or write smarter function?

thanks

Alex Glaros





--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Abhijit Chatterjee | 1 Mar 20:22 2015
Picon

Anyone interested in web2py consulting?

Hello,

I am learning web2py framework and I am new in web design. So, I would like to work with someone on few projects and hopefully learn a lot. Anyone interested in consulting/tutoring? I am open for ideas/prices...any thoughts?

Ron

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Lisandro | 1 Mar 19:40 2015
Picon

How to get host and scheme from a scheduled task?

From the book (scheduler documentation) [1]: 
"Tasks differ from a controller action because they are not associated with an HTTP request and therefore there is no request.env"

I have several method fields that generate urls using URL() function with args scheme=True and host=True, but when those methods are called from a scheduled task, the "host" in the final url is 127.0.0.1, and I need it to be the main domain. 

So, is it possible to get host and scheme from a scheduled task given that there is no http request? Thanks in advance.

[1] - http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Dragan Matic | 1 Mar 13:33 2015
Picon

How to hide app name and how to prevent name "leakage" if hosting multiple apps on one server?

Let's say that I have application named app1 and I am hosting it on www.app1.com domain. I would like application name not to be shown. If for instance I have two controllers, ctr1 and ctr2, URL helper will always generate addresses like www.app1.com/app1/ctr1/some_function and www.app1/app1/ctr2/some_function and I would like to have something like www.app1.com/ctr/some_function - URL without application name.

Second question is if I have two applications hosted on the same server (app1 and app2, registered on www.app1.com and www.app2.com domains) I know that if I setup routes.py something like domains = {'www.app1.com' : 'app1', 'www.app2.com' : 'app2'} then app1 will be shown on www.app1.com and app2 will be shown on www.app2.com. However, that doesn't prevent the user to type something like www.app1.com/app2/default/index and app2 will we shown on www.app1.com domain. Is there a way to prevent this or each application must be hosted on separate server?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kelvin Nyota | 28 Feb 14:07 2015
Picon

Highlighting text in a text area component on web2py

I need a code for highlighting text with a different color on web2py, text area component and to show a drop down list before the bad words are replaced.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kelvin Nyota | 27 Feb 15:15 2015
Picon

How do you highlight text you have searched for replacing on a text area form

How do you highlight a text you have searched for replacing on a text area form for a grammar checker. I need this to allow a user to decide first before he or she replaces the word from a drop down text that should appear on the hightlighted text. Please help me guys, I am trying to build a grammar checker. This is a python Web2py question.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Kelvin Nyota | 27 Feb 22:14 2015
Picon

Web2py python grammar checker



I am trying to implement a python grammar checker on web2py. I  already have the part of the code that needs modification. What I need is a code that can highlight text on the searched words that need replacing by showing a drop down list of better suggestions when you point at it. The code should highlight text with a different color and warn the user before the replacement is made like what microsoft word does. My code on the terminal does not do that at all. It just changes the words without warning the user which can be risky. I will share with you the part of the code that needs modification. Please help!

Please tell me the parts that need modification or changing:

class WordReplacer(object):
            def __init__(self, word_map):
                self.word_map = word_map
   
            def replace(self, word):
                return self.word_map.get(word, word)


class CsvWordReplacer(WordReplacer):
            def __init__(self, fname):
                word_map = {}
                for line in csv.reader(open(fname)):
                    word, syn = line
                    word_map[word] = syn
                super(CsvWordReplacer, self).__init__(word_map)


class YamlWordReplacer(WordReplacer):
            def __init__(self, fname):
                word_map = yaml.load(open(fname))
                super(YamlWordReplacer, self).__init__(word_map)



class AntonymReplacer(object):
            def replace(self, word, pos=None):
                antonyms = set()
                for syn in wordnet.synset(word, pos=pos):
                    for lemma in syn.lemmas:
                        for antonym in lemma.antonyms():
                            antonyms.add(antonym.name)
                if len(antonyms) == 1:
                    return antonyms.pop()

                else:
                    return None


            def replace_negations(self, sent):
                i, l = 0, len(sent)
                words = []
                while i < l:
                    word = sent[i]
                    if word == 'not' and i+1 < l:
                        ant = self.replace(sent[i+1])
                        if ant:
                            words.append(ant)
                            i += 2
                            continue
                        words.append(word)
                        i += 1
                    return words


class AntonymWordReplacer(WordReplacer, AntonymReplacer):
        pass

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
cmrs reddy | 27 Feb 18:11 2015
Picon

how to run cron job or scheduler in python anywhere

let take a example , i want to run a mail function from scheduler. i made mail.py under the modules

from gluon.tools import Mail
    mail=Mail()
    mail.settings.server='smtp.gmail.com:587'
    mail.settings.login='ass.aa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org:aaaaaa'
    mail.settings.sender='aaa.aa-xj2KXvKSavI@public.gmane.org'
    mail.send(to=['aaa <at> aaa.a,'],
    subject='aaaaaa',
    message='<html>'
'<body>'
                            'test mail'
                        '</body>'
                    '</html>')

my corntab file is



0-59/1  *  *  *  * root *applications/comv1/modules/mail1.py


scheduler.py file which under home > application name of pythonanywhwer 

#/usr/bin/env python
import os
import socket
import sys
import subprocess
filename = os.path.abspath(__file__)  # we use this to generate a unique socket name
try:
socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM).bind('\0' + filename)
except socket.error:
print("Failed to acquire lock, task must already be running")
sys.exit()
subprocess.call(["python", "web2py/web2py.py", "-K", "comv3"])



after this also i am not able to run cron job.....

can any one help me


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Pekka | 28 Feb 08:59 2015
Picon

Create alias referencing a part of the table

Hi,
Is it possible to create alias which would reference only a part of the table?

Check the example code below. I would like to create the "host" alias so that it would include the condition role=='host'. Then I wouldn't have to specify this condition every time I use the alias.

db.define_table('party', Field('place') )

db.define_table('participant', Field('party_id', 'reference party'), Field('name'), Field('role') ) db.party.insert(place="Jane's home") db.participant.insert(name='Jane',party_id=1,role='host') db.participant.insert(name='George',party_id=1,role='organizer') db.participant.insert(name='John',party_id=1,role='guest') db.participant.insert(name='Mary',party_id=1,role='guest')
host = db.participant.with_alias('host') organizer = db.participant.with_alias('organizer') rows = db().select( db.party.place, host.name, organizer.name, left=( host.on((host.party_id==db.party.id) & (host.role=='host')), organizer.on((organizer.party_id==db.party.id) & (organizer.role=='organizer')) ) )

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane