Skip to content

Commit

Permalink
python highlight for github
Browse files Browse the repository at this point in the history
  • Loading branch information
nirizr authored Jul 8, 2016
1 parent eceeaab commit 840e99c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ For debugging like setup you'll need (but since it's used for internal tools, th

### Basic examples ###
This example will set up an http server, get one valid input, tear the http server down, print a welcoming message to stdout and exit:
```
#!python
```python
def main():
parser = argparse.ArgumentParser()

Expand All @@ -41,8 +39,7 @@ if __name__ == "__main__":
```

This example will also run until stopped, printing a welcoming message for every valid input:
```
#!python
```python
def main():
parser = argparse.ArgumentParser()

Expand All @@ -57,8 +54,7 @@ if __name__ == "__main__":
```

This example will print the welcoming message in the http response, sending it back to the user:
```
#!python
```python
def welcome(opts):
print("Hello {name},\nthis is a simple example.".format(name=opts.name))

Expand All @@ -85,8 +81,7 @@ This snippet includes three modes of operation for the webui utility:
3. exposing an `application` global object that supports the wsgi interface. once you point a browser with correct wsgi configuration (was a bit of a pain for me first time) it'll work like magic :)

myapp.py:
```
#!python
```python
def get_parser():
"""Generate generic argument parser"""
cmd_parser = argh.ArghParser()
Expand Down Expand Up @@ -136,8 +131,7 @@ else:
wsgi()
```
index.wsgi:
```
#!python
```python
# TODO: replace with your application path
# i found now way to get it automatically in wsgi :/
APP_DIR = '/var/www/myapp'
Expand All @@ -159,4 +153,4 @@ More examples are at `test.py`
Done:

* some code reordering is needed (split template to another file - it's grown quite big, handle action parameters better - shouldn't pass everything as html attributes although it's comfortable)
* smoother integration into existing code.
* smoother integration into existing code.

0 comments on commit 840e99c

Please sign in to comment.