webpy+DBUtils是如何将数据库连接数占满的

webpy中auto_application的cookie共享问题

妙音 posted @ 2013年11月16日 09:27 in webpy , 2476 阅读

在webpy中使用auto_application划分网站的url结构,会发现是个很好用的东西。

使用过程中却发现每个auto_application默认有自己单独的cookie。

范例

#encoding=utf-8
import web
appA = web.auto_application()
appB = web.auto_application()

urls = (
    '/save',   appA,
    '/get',    appB
)

class SaveName(appA.page):
    path = '/?'

    def GET(self):
        web.setcookie("name", "wyq", expires=24 * 60 * 60)
        return web.cookies().get("age")


class GetName(appB.page):
    path = '/?'

    def GET(self):
        return web.cookies().get("name")

app = web.application(urls, globals())

if __name__ == '__main__':
    web.config.debug = True
    app.run()
    #print app.request("/save").data
    #print app.request("/get").data

上面代码,生成两个auto_application appA与appB。

appA处理所有以/save开头的url请求,appB处理所有以/get开头的url请求。

appA = web.auto_application()
appB = web.auto_application()

发送http://0.0.0.0:8080/save请求,将name信息保存在cookie中。

web.setcookie("name", "wyq", expires=24 * 60 * 60)
 
发送http://0.0.0.0:8080/get请求,获取name值。
预想是返回name值,却发现结果为空。什么原因呢?
观察下面从chrome中取到的截图。
/save请求
 
注意上面的Set-Cookie,多了个path=/save/。原来在application中保存cookies时,会设置cookies的path属性。
 
cookie的path属性,用于限制cookie的访问域,只有此域下的请求才能取到此cookie信息。
换句话说只有url以/save/开头的请求才能,取到此cookie的信息。
上面appA属于/save/域下的,appB属于/get/域下的。它们属于不同的域,所以appB访问不到appA中的cookie。
 
如何解决呢?办法就是在设置cookie时添加path="/"的属性,即可解决。
web.setcookie("name", "wyq", expires=24 * 60 * 60, path="/")
 
 
 
Avatar_small
Lagend SEO 说:
2020年12月14日 16:28

nice bLog! its interesting. thank you for sharing.... soap2day.world

Avatar_small
먹튀검증업체 说:
2020年12月27日 17:06

Great knowledge, do anyone mind merely reference back to it 먹튀검증업체

Avatar_small
ryse residences cond 说:
2021年1月07日 15:37

ดูบอลออนไลน์ ดูบอลสด ต้องดูบอลรวย อัพเดทสดใหม่ทุกวัน พร้อมทั้งมี ไฮไลท์บอล โปรแกรมบอล ผลบอล ราคาบอล หรือ ข่าวสารกีฬา และ ข่าวดังข่าวกระแสอีกมากมาย <a href="http://ดูบอลรวย.com/">ดูบอลออนไลน์</a>

Avatar_small
ryse residences cond 说:
2021年1月07日 18:42

Apply Fastag ICICI Bank is a brand name owned by Indian Highways Management Company Ltd. (IHMCL) which carries out electronic tolling and other ancillary projects of National Highway Authorities of India (NHAI). This Radio Frequency Identification Device (RFID) tag is affixed on the windscreen of the vehicle.

Avatar_small
ryse residences cond 说:
2021年1月07日 21:29

The UAN or Unifiedportal.epfindia.gov.in Account Number is an umbrella number for the multiple Employee Provident Fund Numbers or Member IDs allotted to an individual by various employers. The idea is to link these multiple employee PF Number of a person to a single 12-digit Universal Account Number. This means the account number remains unchanged across organizations since it is linked to a particular person.

Avatar_small
ดูหนังโป๊ออนไลน์ 说:
2021年1月07日 22:18

Your post is very helpful to get some effective tips to reduce weight properly. You have shared various nice photos of the same. I would like to thank you for sharing these tips. Surely I will try this at home. Keep updating more simple tips like this.  ดูหนังโป๊ออนไลน์

Avatar_small
ryse residences cond 说:
2021年1月08日 14:46

To avail the Transfer claim or Advance Withdrawal Claim or Permanent Withdrawal Claim facilities, updating KYC is a mandatory requirement. Once the KYC details are submitted by the employees, the employer has to verify and approve the KYC details using the Digital Signature registered on the Employees Provident Fund Establishment Portal i.e Unifiedportal-emp.epfindia.gov.in.

Avatar_small
먹튀검증 说:
2021年1月12日 18:57

Very good points you wrote here..Great stuff...I think you've made some truly interesting points.Keep up the good work. 먹튀검증

Avatar_small
전설 서구 说:
2021年1月14日 14:49

Fabulous post, you have denoted out some fantastic points, I likewise think this s a very wonderful website. I will visit again for more quality contents and also, recommend this site to all. Thanks. best canadian online casino

Avatar_small
no excuses runner 说:
2021年1月19日 18:57

I love visiting sites in my free time. I have visited many sites but did not find any site more efficient than yours. Thanks for the nudge! สมัคร slot เครดิตฟรี แค่ยืนยันตน

Avatar_small
Faddy 说:
2021年1月23日 20:00

Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you 먹튀검증

Avatar_small
ryse residences cond 说:
2021年1月23日 21:00

At We Walk Together L LC, we are dedicated to providing patients with the best possible care. We at WE WALK TOGETHER LLC are focused on helping you. Sport physical

Avatar_small
198.168.0.1 User Nam 说:
2021年1月27日 21:06

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. 198.168.0.1 User Name

Avatar_small
審計 報告 说:
2021年1月28日 20:43

Wow, this is really interesting reading. I am glad I found this and got to read it. Great job on this content. I like it. 審計 報告

Avatar_small
tik tok takipçi satı 说:
2021年1月30日 02:37

Extraordinary things you've generally imparted to us. Simply continue written work this sort of posts.The time which was squandered in going for educational cost now it can be utilized for studies.Thanks tik tok takipçi satın al

Avatar_small
ryse residences cond 说:
2021年2月02日 23:17

HayatMed Clinic Provide High Quality convenient and affordable hair transplant surgery in Turkey, Our doctors have years of experience. Please visit our website for free consultation.

Avatar_small
ryse residences cond 说:
2021年2月03日 20:34

The first phase the preparation should, theoretically, be uninfluenced by the intended intensity and duration of the sound which is subsequently produced. In fact, however, so quickly are the three phases accomplished that the pianist rarely has capacity to think, in performance, of each phase separately. เบ้นซ์

Avatar_small
Amaresh Mishra 说:
2021年2月04日 11:57

Allahabad Bank started its operation in the year 1865 and is headquartered in Kolkata. The bank offers a wide range of banking products and financial services to its customers like debit cards, credit cards, mobile banking, netbanking and more. <a href='https://onlinenet-banking.in/allahabad-bank-online-net-banking-registration/'>Allahabad Bank online banking</a> allows its users to do banking transactions such as transferring money, paying a bill, checking balance or setting up a regular payment on bank etc.

Avatar_small
Amaresh Mishra 说:
2021年2月04日 11:58

After the successful generation of password, the users can carry out a host of allahabad bank online banking services via the net banking portal including balance check, account statement, funds transfer and more

Avatar_small
remote work confiden 说:
2021年2月05日 14:10

I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. remote work confidence building

Avatar_small
Weight Loss 说:
2021年2月08日 03:44

A lot of people having an incorrect image about the cash advance loans or sometimes refer it as bad credit payday loans. gator fencing

Avatar_small
hotel amenities 说:
2021年2月09日 01:27

Your post has those facts which are not accessible from anywhere else. It’s my humble request to u please keep writing such remarkable articles hotel amenities

Avatar_small
LegalTech 说:
2021年2月09日 15:18

I truly value this superb post that you have accommodated us. I guarantee this would be helpful for a large portion of the general population. LegalTech

Avatar_small
Small Claims Portal 说:
2021年2月09日 19:01

I was impressed with the site that you created, so memotipasi many people to be more advanced, there also kunjugi me, as a comparison Small Claims Portal

Avatar_small
no excuses runner 说:
2021年2月10日 21:48

You have a real talent for writing unique content. I like how you think and the way you express your views in this article. I am impressed by your writing style a lot. Thanks for making my experience more beautiful. NAPSRX

Avatar_small
body contouring 说:
2021年2月11日 13:15

First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. body contouring

Avatar_small
Magento eCommerce ag 说:
2021年2月11日 14:29

Thanks for the tips guys. They were all great. I have been having issues with being fat both mentally and physically. Thanks to you guys i have been showing improvements. Do post more. Magento eCommerce agency in London England

Avatar_small
I Am Talha Anjum Off 说:
2021年2月17日 14:51

Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info. allbet

Avatar_small
Faddy 说:
2021年2月17日 20:12

Our credit repair services work to fix past credit mistakes and verify credit report accuracy. Talk to a credit repair expert today! 꽁머니 1만

Avatar_small
토토사이트 说:
2021年2月18日 14:52

Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.

Avatar_small
Weight Loss 说:
2021年2月22日 15:07

Thanks for the blog filled with so many information. Stopping by your blog helped me to get what I was looking for. Now my task has become as easy as ABC. 토토

Avatar_small
ryse residences cond 说:
2021年2月22日 22:06

UP Board students will be able to collect their UP Board 10th Admit Card 2021 from their respective schools in January. The State Board will be releasing the UP Board 10th Admit Card 2021 on its official website for the private students. They will be able to download the UP Board Admit Card for Class 10th using their username and password. The admit card mentions the student’s name, roll number, exam dates, exam centre details, etc. UPMSP 10th Admit Card 2021

Avatar_small
virtual office Los A 说:
2021年2月23日 18:12

I'm constantly searching on the internet for posts that will help me. Too much is clearly to learn about this. I believe you created good quality items in Functions also. Keep working, congrats! virtual office Los Angeles

Avatar_small
Weight Loss 说:
2021年2月26日 15:13

If you want to organize a family photo shoot, please don’t hesitate to contact me at any time. Family photographer London

Avatar_small
ryse residences cond 说:
2021年2月26日 21:35

Play Online Rummy Card and Cricket Games on India’s Number 1 & Best Online Game Website. Get up to ₹1000 daily bonus. Enjoy with 24Club now cricket score

Avatar_small
ryse residences cond 说:
2021年2月27日 15:21

NEVER PAY UP-FRONT FEES.USE ESCROW TO EXIT YOUR TIMESHARE timeshare freedom group

Avatar_small
Weight Loss 说:
2021年2月28日 02:59

Get the latest breaking and in-depth news,headlines,photos and videos on radical Islamic terrorist groups. Whether you are Muslim or not your input is vital.For any information,ideas,opinions contact us or write us @ shaniathura@gmail.com International Politics News

Avatar_small
Weight Loss 说:
2021年3月05日 01:20

In addition, there are Para-Okazino, Coin Casino, Sands Casino, Okada Casino, Merit Casino, First Casino, Duzon Casino, and SM Casino. https://lampcasino

Avatar_small
Weight Loss 说:
2021年3月07日 00:01

Hi, welcome to our webpage, please be patient as we are updating daily. ipe

Avatar_small
Weight Loss 说:
2021年3月07日 01:03

Share your files directly using email or you can share using a secure link Transfer Large File

Avatar_small
Weight Loss 说:
2021年3月08日 02:36

Pool Plaster Inc. | quartz plaster | Pool Renovation Services Boston quartzscape

Avatar_small
Removal company near 说:
2021年3月15日 01:46

You guardians do an astounding web diary, and have some unfathomable substance. Continue doing extraordinary. Removal company near me

Avatar_small
Weight Loss 说:
2021年3月19日 01:34

Write.law is a game changer for training lawyers and law students alike. The breadth and depth of the skills you can improve—from legal tech to legal writing—are impressive, as are its seamless platform and interactive lessons. I highly recommend Write.law for everyone. Lawyer Courses and Classes

Avatar_small
ryse residences cond 说:
2021年3月19日 17:18

The Lampliter | Indianapolis outdoor lighting, Installation & Maintenance in Central IN, our Outdoor Lighting Professionals.

Avatar_small
ryse residences cond 说:
2021年3月23日 20:51

Get free Powerful Learning English Lessons, We share great materials and useful articles, tutorials and videos on Gr8English.com to help individuals who are learning English. Improve Your English With Online Video Lessons. Please visit our website for a unique way to learn english. Thank You.

Avatar_small
tadalafil 说:
2021年3月24日 02:16

Buy tadalafil on Access Doctor - Online Doctor & Pharmacy UK | Free Delivery | Access Doctor including its uses, side effects and safety, interactions, pictures, warnings and user ratings.

Avatar_small
crime scene cleanup 说:
2021年3月25日 02:23

crime scene cleanup missouri after death cleaning help in cities in Missouri Get quotes for crime scene cleanup missouri or blood cleanup suicide cleanup throughout Missouri for free.

Avatar_small
ryse residences cond 说:
2021年3月29日 19:42

Let Paillian help you find the perfect custom gift! We offer free consultations for specific custom items Please use our contact page We cant wait to make you something! Buy Custom Items Online Contact us for more details.

Avatar_small
Outlet Mall near Me 说:
2021年4月08日 14:12

Easily Locate Shopping Outlet Mall near Me as in Your Area from the Most Reputable Online Directory Satisfy Your Shopping Needs Fast with Malls Near Me, Locate Shopping & Outlet Malls Near Me Fast!

Avatar_small
Headshots Atlanta 说:
2021年5月18日 04:42

David and Jess are your Atlanta Photographers The professional Atlanta photographers for all of your Atlanta photography needs 850 512 6275 Portraits, Headshots Atlanta, Online dating pictures and more Serving Atlanta and surrounding areas.

Avatar_small
cyprus permanent res 说:
2021年5月20日 21:22

Invest in cyprus permanent residency program and establish a Mediterranean home away from home Requirements Benefits. Cyprus Permanent Residence Program - By Investment. Cyprus Residency Program offers the opportunity for those acquiring property to establish a Mediterranean home and becoming resident in Cyprus. Please visit our website for more details. Thank You.

Avatar_small
Custom bobbleheads c 说:
2021年5月25日 19:57

Hi Looking for Custom bobbleheads cheap? Make Your Own Personalized bobblehead- Dolls Make your own bobblehead Made From Your Photos 50 148 with Amazing Likeness and Fast Turnaround Time, Offer Gift Box and Card, 100 Satisfactios. At Bbobbler, we use high-quality material for designing the bobbleheads.

Avatar_small
slope unblocked 66 说:
2021年6月17日 22:15

Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! slope.io

Avatar_small
Faddy 说:
2021年6月19日 21:01

Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign. Face mask

Avatar_small
토토사이트 说:
2021年7月13日 21:52

You have performed a great job on this article. It’s very precise and highly qualitative. You have even managed to make it readable and easy to read. You have some real writing talent. Thank you so much. 토토사이트

Avatar_small
saksham login 说:
2022年3月09日 13:09

The Government of Haryana State has designed the School Management Information System for the welfare of Schools in the state. The school staff, teachers, and students have got direct access to the portal through which most of the services easily processed. saksham login The MIS Portal also referred to as Saksham Haryana Education Portal which is a one-stop website for every need of Schools in Haryana. The New aspirants can utilize this option to apply for their selected school form online by submitting the application form.

Avatar_small
mm8bet 说:
2022年4月20日 00:36

As a seller of legal steroids, you can buy Crazy Bulk products, explore stacks and finally get the body you’ve always wanted

Avatar_small
คาสิโนออนไลน์ เว็บตร 说:
2022年4月22日 05:22

You completed certain reliable points there. I did a search on the subject and found nearly all persons will agree with your blog.

Avatar_small
Buy marijuana online 说:
2022年5月08日 03:33

I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… Buy marijuana online

Avatar_small
fixed deposit 说:
2022年5月14日 06:15

Glad to chat your blog, I seem to be forward to more reliable articles and I think we all wish to thank so many good articles, blog to share with us. fixed deposit

Avatar_small
สูตรบาคาร่า ใช้ได้จร 说:
2022年6月08日 05:06

I see some amazingly important and kept up to length of your strength searching for in your on the site สูตรบาคาร่า ใช้ได้จริง

Avatar_small
heels 说:
2022年8月01日 07:05

I have a mission that I’m just now working on, and I have been at the look out for such information heels

Avatar_small
dark web/deep web/d 说:
2022年8月09日 14:57

Look closely at each link and see if they are legit or not. Some of them will be links to scam websites that claim that you can get rich overnight. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月09日 15:31

Link farms are websites which exist solely to collect numerous links from web directories. The more links they have, the higher their site will climb in the rankings of search engine results.  deep web

Avatar_small
dark web/deep web/d 说:
2022年8月09日 16:22

All you need to do is make sure that you choose a product that is relevant to your own site. You will be able to make much more profit by only picking relevant products. dark web sites

Avatar_small
dark web/deep web/d 说:
2022年8月09日 19:43

If the person has created a profile on any of these websites, there should be a section where you can enter the URL address of the website. Be prepared to spend a few minutes doing this. dark web links

Avatar_small
ghananewsonline 说:
2022年8月09日 22:33

GHANA News ONLINE is a content curation and syndication website to offer news stories across the length and breadth of Ghana. ghananewsonline

Avatar_small
HDFC Ergo policy ren 说:
2022年8月15日 17:39

Car Insurance is an important and priority task attested with your car, and this is to safeguard against the unknown effect of theft, malicious damage, natural calamities or accidents, and here even a minor repair does cost you a lot and thus having a car insurance policy always does protect you and does make you financially stable.HDFC ERGO car insurance is one of the choices for best car insurance. HDFC Ergo policy renewal. It does provide an easy way to access existing policy and renewed it online. Under the Motor vehicle Act 2019, it is compulsory to have Insurance for Vehicles at any means of cost.

Avatar_small
HDFC Ergo policy ren 说:
2022年8月15日 17:42

Car Insurance is an important and priority task attested with your car, and this is to safeguard against the unknown effect of theft, malicious damage, natural calamities or accidents, and here even a minor repair does cost you a lot and thus having a car insurance policy always does protect you and does make you financially stable.HDFC ERGO car insurance is one of the choices for best car insurance. <a href="https://99employee.com/hdfc-ergo-car-insurance-renewal-online/">HDFC Ergo policy renewal</a>. It does provide an easy way to access existing policy and renewed it online. Under the Motor vehicle Act 2019, it is compulsory to have Insurance for Vehicles at any means of cost.

Avatar_small
HDFC Ergo policy ren 说:
2022年8月15日 17:43

Car Insurance is an important and priority task attested with your car, and this is to safeguard against the unknown effect of theft, malicious damage, natural calamities or accidents, and here even a minor repair does cost you a lot and thus having a car insurance policy always does protect you and does make you financially stable.HDFC ERGO car insurance is one of the choices for best car insurance. <a href="https://99employee.com/hdfc-ergo-car-insurance-renewal-online/">HDFC Ergo policy renewal</a>. It does provide an easy way to access existing policy and renewed it online. Under the Motor vehicle Act 2019, it is compulsory to have Insurance for Vehicles at any means of cost.

Avatar_small
Bitmain Antminer T19 说:
2022年8月23日 05:46

I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… Bitmain Antminer T19

Avatar_small
Коса Беляус 说:
2022年8月26日 01:42

ОТДЫХ ВСЕЙ СЕМЬЕЙ Особое внимание мы уделили детским программам, чтобы Вы могли полноценно расслабиться и насладиться отпуском. Коса Беляус

Avatar_small
milk frother mixer 说:
2022年8月31日 03:46

I really thank you for the valuable info on this great subject and look forward to more great posts milk frother mixer

Avatar_small
biologique recherche 说:
2022年9月01日 03:16

I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… biologique recherche marina bay sands

Avatar_small
non binary clothes 说:
2022年9月01日 04:28

very interesting post.this is my first time visit here.i found so many interesting stuff in your blog especially its discussion..thanks for the post! non binary clothes

Avatar_small
breaking news 说:
2022年9月02日 06:28

Cool stuff you have and you keep overhaul every one of us breaking news

Avatar_small
paypal goods and ser 说:
2022年9月05日 04:23

What a really awesome post this is. Truly, one of the best posts I've ever witnessed to see in my whole life. Wow, just keep it up. paypal goods and services

Avatar_small
naked url 说:
2022年9月06日 20:10

I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon… naked url

Avatar_small
Canadian Fake Perman 说:
2022年9月10日 08:15

Hi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job! Canadian Fake Permanent Resident Card

Avatar_small
Pay Credit Card Bill 说:
2022年9月11日 04:18

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it. Pay Credit Card Bill


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter