Beispiel #1
0
if 'id' in form:
    pageId = form["id"].value
    description = open('./data/'+pageId, 'r', encoding="utf-8").read()
    description = sanitizer.sanitize(description)

else:
    pageId = 'Welcome'
    description = 'Hello, web'


print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ol>
    {listStr}
  </ol>
  <a href="create.py">create</a>
  <form method="POST" action="./process_create.py">
    <p><input type="text" name="title" placeholder="title"></p>
    <p><textarea rows="10" name="description" placeholder="description"></textarea></p>
    <p><input type="submit"></p>
  </form>
</body>
</html>
'''.format(listStr=view.getList()))
Beispiel #2
0
form = cgi.FieldStorage()
if 'id' in form: #id라는게 form안에 있을 경우에 true
    pageId = form['id'].value
    with open('data/'+pageId) as f:
        description = f.read()
else:
    pageId = 'Welcome'
    description = 'Hello Web'
print('''<!doctype html>
<html>
<head>
<title>WEB1 - Welcome</title>
<meta charset="utf-8">
</head>
<body>
<h1><a href="index.py">WEB</a></h1>
<ol>
{list}
</ol>
<a href="create.py">create</a>
<form action="process_update.py" method="post">
    <input type="hidden" name="pageId" value="{title_value}">
    <p><input type="text" placeholder="title" name="title" value="{title_value}"></p>
    <p><textarea rows="4" placeholder="description" name="description" >{description_value}</textarea></p>
    <p><input type="submit"></p>
</form>
<body>
</html>
'''.format(title=pageId, content=description, list=view.getList(), title_value=pageId, description_value=description))
Beispiel #3
0
form = cgi.FieldStorage()
if 'id' in form:
  pageId = form["id"].value
  description = open('data/' + pageId, 'r').read()
else:
  pageId = 'Welcome'
  description = 'Hello, web'

print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ol>
    {listStr}
  </ol>
  <a href = "create.py">create</a>
  <form action = "process_create.py" method = "post">
    <p><input type = "text" name = "name" placeholder = "title"></p>
    <p><textarea rows="4" name= "description" 
    placeholder = "description"></textarea></p>
    <p><input type = "submit"></p>
  </form>
</body>
</html>
'''.format(title=pageId, desc=description, listStr=view.getList()))
Beispiel #4
0
    delete_action = '''
        <form action="process_delete.py" method="post">
            <input type="hidden" name="pageId" value="{}">
            <input type="submit" value="delete">
        </form>
    '''.format(pageId)
else:
    title = pageId = 'Welcome'
    description = 'Hello Web'
    update_link = ''
    delete_action = ''
print('''<!doctype html>
<html>
<head>
<title>WEB1 - Welcome</title>
<meta charset="utf-8">
</head>
<body>
<h1><a href="index.py">WEB</a></h1>
<ol>
{list}
</ol>
<a href="create.py">create</a>
{update_link}
{delete_action}
<h2>{title}</h2>
<p>{content}</p>
<body>
</html>
'''.format(title=title, content=description, list=view.getList(), update_link = update_link, delete_action=delete_action))
Beispiel #5
0
</head>
<body>
    <h1><a href="index.py">WEB</a></h1>
    <input id="night_day" type="button" value="night" onclick="
        nightDayHandler(this);
    ">
    <input id="create" type="button" value="Create" onclick="
        location.href='create.py';">
    {update_button}
    {delete_action}
    <div id="grid">
        <div id="category">
            <h3>By Younghwani</h3>
            <ol>{listStr1}</ol>
            <h3>By All Users</h3>
            <ol>{listStr2}</ol>
        </div>
        <div id="article">
            <h2>{title}</h2>
            <p>{desc}</p>
        </div>
    </div>
</body>
</html>
'''.format(title=title,
           desc=description,
           listStr1=view.getList('data/admin'),
           listStr2=view.getList('data/create_data'),
           update_button=update_button,
           delete_action=delete_action))
#listStr1 : 관리자 작성, listStr2 : 모든 유저 접근
Beispiel #6
0
    delete_action = '''
        <form action="process_delete.py" method="post">
            <input type="hidden" name="pageId" value="{}">
            <input type="submit" value="delete">
        </form>
    '''.format(pageId)
else:
    pageId = 'Welcome'
    description = 'Hello, web'
    update_link =''
print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ol>
    {listStr}
  </ol>
  <a href="create.py">create</a>
  {update_link}
  {delete_action}
  <a href="update.py">update</a>
  <h2>{title}</h2>
  <p>{desc}</p>
</body>
</html>
'''.format(title=pageId, desc=description, listStr=view.getList(),update_link=update_link, delete_action=delete_action))
Beispiel #7
0
        pageId = form["id"].value
        description = open('data/'+pageId,'r').read()
else :
          pageId='Welcome'   
          description='hello web'

print('''
<!doctype HTML>
<html>
<head>
        <title>WEB</title>
        <meta charset="utf-8"> 
        <link rel="stylesheet" href="style.css">
</head>
<body>
        <h1><u><a href="index.py">WEB</a></u></h1>
<ol>
{listStr}
</ol>
<form action="process_create.py" method="POST">
    <a href="create.py">create</a>
    <p><input type="text" name="title" placeholder="title"></p>
    <p><textarea rows="4" name="description" placeholder="description"></textarea></p>
    <p><input type="submit"></p>
</form>
</body>
</html>
'''.format(title=pageId,desc=description,listStr=view.getList()))


Beispiel #8
0
<!doctype html>
<html>

<head>
  <title>Web Welcome HOME</title>
  <meta charset="utf-8">
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <h1><a href="index.py" title="Homepage">WEB</a></h1>

  <div id="grid">
    <ol>
      <a href="create.py">create</a>
      {list}
    </ol>
    <div id="article">
      <form action="process_update.py" method="post">
        <input type="hidden" name="pageId" value={_title}
        <p><input type="text" name="title" value={_title}></p>
        <p><textarea rows="20" name="description">{_description}</textarea></p>
        <p><input type="submit" value="update"></p>
      </form>
    </div>
  </div>
</body>

</html>
'''.format(_title=title,_description=description,list=getList()))
Beispiel #9
0
import cgi, os, view

form = cgi.FieldStorage()
if 'id' in form:
    pageId = form["id"].value
    description = open('data/'+pageId, 'r').read()
else:
    pageId = 'Welcome'
    description = 'Hello, web'
print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ol>
    {listStr}
  </ol>
  <a href="create.py">create</a>
  <form action="process_update.py" method="post">
      <input type="hidden" name="pageId" value="{form_default_title}">
      <p><input type="text" name="title" placeholder="title" value="{form_default_title}"></p>
      <p><textarea rows="4" name="description" placeholder="description">{form_default_description}</textarea></p>
      <p><input type="submit"></p>
  </form>
</body>
</html>
'''.format(title=pageId, desc=description, listStr=view.getList(), form_default_title=pageId, form_default_description=description))
Beispiel #10
0
    description = 'Hello, web'
print('''
<!DOCTYPE html>
<html>
    <head>
        <title>WEB2 - Python</title>
        <meta charset="utf-8">
    </head>
    <body>
        <h1><a href="index.py">Python</a></h1>
        <ol>
            {lists}
        </ol>
        <a href="create.py">create</a>
        <p>
            <form action="create_process.py" method="post">
                <p>
                    <input type="text" name="title" placeholder="title">
                </p>
                <p>
                    <textarea rows="4" name="description" placeholder="description"></textarea>
                </p>
                <p>
                    <input type="submit">
                </p>
            </form>
        </p>
    </body>
</html>
'''.format(lists=view.getList(), title=pageId, desc=description))
Beispiel #11
0
print('''
<!DOCTYPE html>
<html>
    <head>
        <title>WEB2 - Python</title>
        <meta charset="utf-8">
    </head>
    <body>
        <h1><a href="index.py">Python</a></h1>
        <ol>
            {lists}
        </ol>
        <a href="create.py">create</a>
        <p>
            <form action="update_process.py" method="post">
                <input type="hidden" name="pageId" value="{form_default_title}">
                <p>
                    <input type="text" name="title" placeholder="title" value="{form_default_title}">
                </p>
                <p>
                    <textarea rows="4" name="description" placeholder="description">{form_default_description}</textarea>
                </p>
                <p>
                    <input type="submit">
                </p>
            </form>
        </p>
    </body>
</html>
'''.format(lists=view.getList(), title=pageId, desc=description, form_default_title=pageId, form_default_description=description))
Beispiel #12
0
<head>
  <title>Web Welcome HOME</title>
  <meta charset="utf-8">
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <h1><a href="index.py" title="Homepage">WEB</a></h1>

  <div id="grid">
    <ol>
        <a href="create.py">create</a>
        {_list}
    </ol>
    <div id="article">
        {_update_link}
        {_delete_link}
        <h2>{_title}</h2>
        <p>{_description}</p>
    </div>
  </div>
</body>

</html>
'''.format(_update_link=update_link,
           _delete_link=delete_link,
           _list=getList(),
           _title=title,
           _description=description))
Beispiel #13
0
    pageId = form["id"].value
    description = open("data/" + pageId, encoding="utf-8").read()
else:
    pageId = "Welcome"
    description = "Hello Web"
print(pageId)
print("""<!DOCTYPE html>
<html lang="KR" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>{title}</title>
  </head>
  <body>
    <h1><a href="index2.py?id=Angel">{desc}</a></h1>
    <a href = "create.py">create</a>
    <form action = "process_update.py" method="post">
        <input type="hidden" name = "pageId" value = "{form_default_title}">
        <p><input type="text" name = "title" placeholder = "title" value = "{form_default_title}"></p>
        <p><textarea rows="4" name = "description" placeholder = "description">{form_default_description}</textarea></p>
        <p><input type="submit"></p>
    </form>
    <ol>
      {listdir}
    </ol>
  </body>
</html>
""".format(title="Airsoft Hobby",
           desc=description,
           listdir=view.getList(),
           form_default_title=pageId,
           form_default_description=description))
Beispiel #14
0
print('''
<!doctype html>
<html>

<head>
  <title>Web Welcome HOME</title>
  <meta charset="utf-8">
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <h1><a href="index.py" title="Homepage">WEB</a></h1>

  <div id="grid">
    <ol>
      <a href="create.py">create</a>
      {list}
    </ol>
    <div id="article">
      <form action="process_create.py" method="post">
        <p><input type="text" name="title" placeholder="title"></p>
        <p><textarea rows="20" name="description" placeholder="description"></textarea></p>
        <p><input type="submit"></p>
      </form>
    </div>
  </div>
</body>

</html>
'''.format(title=title, desc=description, list=getList()))
Beispiel #15
0
print("Content-Type: text/html; charset=utf-8\r\n")
print()
form = cgi.FieldStorage()
if "id" in form:
    pageId = form["id"].value
    description = open("data/" + pageId, encoding="utf-8").read()
else:
    pageId = "Welcome"
    description = "Hello Web"
print(pageId)
print("""<!DOCTYPE html>
<html lang="KR" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>{title}</title>
  </head>
  <body>
    <h1><a href="index2.py?id=Angel">{desc}</a></h1>
    <a href = "create.py">create</a>
    <form action = "process_create.py" method="post">
        <p><input type="text" name = "title" placeholder = "title"></p>
        <p><textarea rows="4" name = "description" placeholder = "description"></textarea></p>
        <p><input type="submit"></p>
    </form>
    <ol>
      {listdir}
    </ol>
  </body>
</html>
""".format(title="Airsoft Hobby", desc=description, listdir=view.getList()))
Beispiel #16
0
sanitizer = html_sanitizer.Sanitizer()
form = cgi.FieldStorage()
if 'id' in form:
    title = pageId = form["id"].value
    description = open('data/' + pageId, 'r').read()
    title = sanitizer.sanitize(title)
    description = sanitizer.sanitize(description)
else:
    title = pageId = "Welcome"
    description = "Hello, web"

print('''<!DOCTYPE html>
<html>
<head>
    <title>WEB1 - Welcome</title>
    <meta charset="utf-8">
</head>
<body>
    <h2><a href="index.py">WEB<h2>
    <ul>
       {listStr} 
    </ul>
<a href = "create.py">create</a>
<form action="process_create.py" method="post">
    <p><input type="text" name="title" placeholder="title"></p>
    <p><textarea rows="4" name="description" placeholder="description"></textarea></p>
    <p><input type="submit"></p>
</form>
</body>
</html>'''.format(title=title, desc=description, listStr=view.getList()))
Beispiel #17
0
    {delete_action}
    <h2><strong>1.WE 베레타(M9시리즈)</strong></h2>
    <h3><a href="https://www.kyairsoft.com/we-m002-m925-m92-chrome.html" target="_blank">WE-M002-M925 M92 (CHROME)</a></h3><br>
    <img src="img_39318_3.jpg", width = 40%><br>
    가격 113.52 달러 -> 현재 세일해서 102달러<br>
    국내 건샵 <a href="http://www.h-guns.com/product/detail.html?product_no=4259&cate_no=367&display_group=1" target="_blank">h-guns</a>에서 21만원에 팔고 있는 것으로 확인<br>
    배송비와 총포협 검사비, 그리고 배송 기간을 따져보았을때 국내에서 사는 것도 나쁘지 않다.
    <h2><strong>2.WE 베레타(M9시리즈) honeycomb edition</strong></h2>
    <h3><a href="https://www.kyairsoft.com/we-m92-honeycomb-pistol-sliver.html" target="_blank">WE-M002-M925 M92 (CHROME)</a></h3><br>
    <img src="img_47817_3.jpg", width = 40%><br>
    가격 108.77달러<br>
    외관 자체는 상당히 간지가 나나 검색을 해도 잘 안나온다. 혹시나 하자가 있지 않을까 불안함.
    <h2><strong>3.WE 데저트 이글 SV</strong></h2>
    <h3><a href="https://www.kyairsoft.com/we-cybergun-licensed-desert-eagle-50-cal-gbb-pistol-with-marking-electroplating-silver.html" target="_blank">WE - CYBERGUN LICENSED DESERT EAGLE .50 CAL GBB PISTOL WITH MARKING (ELECTROPLATING SILVER)</a></h3><br>
    <img src="img_42225_1898_2.jpg", width = 40%><br>
    가격 164.82 달러<br>
    각인과 정식 라이센스를 받아서 가격이 상당히 나가는 편이다. 그래도 간지는 ㅇㅈ
    <h2><strong>4.KWC 미니 우지</strong></h2>
    <h3><a href="https://www.kyairsoft.com/we-cybergun-licensed-desert-eagle-50-cal-gbb-pistol-with-marking-electroplating-silver.html" target="_blank">WE - CYBERGUN LICENSED DESERT EAGLE .50 CAL GBB PISTOL WITH MARKING (ELECTROPLATING SILVER)</a></h3><br>
    <img src="KWC_SMG_UZIV2_01_default_logo_tr.png", width = 40%><br>
    가격 155 달러<br>
    CO2탄을 사용한다. 한 손으로 드르륵 갈길 수 있는게 매력.<br>
    KWC사가 2017년 전에 만든 가스총은 MP7말고 다 ㅄ이었다는게 불안 요소
    <ol>
      {listdir}
    </ol>
  </body>
</html>
""".format(title = title, desc = description, 
listdir = view.getList(), update_link = update_link, delete_action = delete_action))
Beispiel #18
0
import cgi, os, view

form = cgi.FieldStorage()
if 'id' in form: #id라는게 form안에 있을 경우에 true
    pageId = form['id'].value
    with open('data/'+pageId) as f:
        description = f.read()
else:
    pageId = 'Welcome'
    description = 'Hello Web'
print('''<!doctype html>
<html>
<head>
<title>WEB1 - Welcome</title>
<meta charset="utf-8">
</head>
<body>
<h1><a href="index.py">WEB</a></h1>
<ol>
{list}
</ol>
<a href="create.py">create</a>
<form action="process_create.py" method="post">
    <p><input type="text" placeholder="title" name="title"></p>
    <p><textarea rows="4" placeholder="description" name="description"></textarea></p>
    <p><input type="submit"></p>
</form>
<body>
</html>
'''.format(title=pageId, content=description, list=view.getList()))
Beispiel #19
0
    pageId = form["id"].value
    description = open('data/' + pageId, 'r').read()
else:
    pageId = 'welcome'
    description = 'Hello. Web'

print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ol>
    {liststr}
  </ol>
  <a href="create.py">create</a>
  <form action="process_update.py" method="post">
    <input type="hidden" name="pageId" value="{form_default_title}">
    <p><input type="text" name="title" placeholder="title" value="{form_default_title}"></p>
    <p><textarea rows="10" name="description" placeholder="contents">{form_default_description}</textarea></p>
    <p><input type="submit"></p>
  </form>
</body>
</html>'''.format(title=pageId,
                  desc=description,
                  liststr=view.getList(),
                  form_default_title=pageId,
                  form_default_description=description))
Beispiel #20
0
##HTML로만 만든 웹사이트와 파이썬을 통해 만든 웹사이트에는 엄청난 차이가 있다. HTML 코드가 index.py에 철저히 갇혀있고, 이것만 바꾸면 모든 페이지에 적용가능하다. 그리고 data폴더안에 내용이 깔끔하게 저장되어있다
##읽어야하는 코드수가 현저하게 줄어드니 나가는 돈도 줄어든다. 폭발적인 변화이다.

print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ul>
    {listStr}
  </ul>
  <a href="create.py">create</a>
   {update_link}
   {delete_action}
  <h2>{title}</h2>
  <p>{desc}</p>
</body>
</html>
'''.format(title=pageId,
           desc=description,
           listStr=view.getList(), #위의 명확하게 표현된 함수를 사용함으로써 가독성을 높인다. 그리고 view.를 통해 view 모듈안에 getList가 있다는 것을 알 수 있다.
           update_link=update_link,
           delete_action=delete_action
           ))


#query string
Beispiel #21
0
    description = open('data/' + pageId, 'r').read()
else:
    pageId = 'Welcome'
    description = 'Hello, web'

print('''<!doctype html>
<html>
<head>
  <title>WEB1 - Welcome</title>
  <meta charset="utf-8">
</head>
<body>
  <h1><a href="index.py">WEB</a></h1>
  <ol>
    {listStr}
  </ol>
  <a href="create.py">create</a>
  <form action="process_update.py" method="post">
      <input type="hidden" name="pageId" value="{form_default_title}">
      <p><input type="text" name="title" placeholder="title" value="{form_default_title}"></p>
      <p><textarea rows="4" name="description" placeholder="description">{form_default_description}</textarea></p>
      <p><input type="submit"</p>
  </form>
</body>
</html>
'''.format(title=pageId,
           desc=description,
           listStr=view.getList(),
           form_default_title=pageId,
           form_default_description=description))
Beispiel #22
0
    update_link = ''
    delete_action = ''
print('''
<!DOCTYPE html>
<html>
    <head>
        <title>WEB2 - Python</title>
        <meta charset="utf-8">
    </head>
    <body>
        <h1><a href="index.py">Python</a></h1>
        <ol>
            {lists}
        </ol>
        <a href="create.py">create</a>
        {update_link}
        {delete_action}
        <h2>
            {title}
        </h2>
        <p>
            {desc}
        </p>
    </body>
</html>
'''.format(lists=view.getList(),
           title=title,
           desc=description,
           update_link=update_link,
           delete_action=delete_action))