Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
manual deploy

cp Snippets/* ~/Library/Application\ Support/Vico/Bundles/vicoapp-python.tmbundle/Snippets/

45 changes: 45 additions & 0 deletions Snippets/New py.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>#!/usr/bin/env python
# coding: utf-8

import os
import sys

import daemon
import gflags
import logging

from pygaga.helpers.logger import log_init
from pygaga.helpers.dbutils import get_db_engine

logger = logging.getLogger('AppLogger')

FLAGS = gflags.FLAGS

def main():
pass

if __name__ == "__main__":
# usage: ${prog} ip:port --daemon --stderr ...
gflags.DEFINE_boolean('daemon', False, "is start in daemon mode?")
log_init('AppLogger', "sqlalchemy.*")
#if FLAGS.daemon:
# file_path = os.path.split(os.path.abspath(__file__))[0]
# daemon.daemonize(os.path.join(file_path, 'app.pid'))
main()

</string>
<key>name</key>
<string>new python</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>py</string>
<key>uuid</key>
<string>2367AA28-A535-40C0-AE04-0195E927CD45</string>
</dict>
</plist>
69 changes: 69 additions & 0 deletions Snippets/New web_py.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>#!/usr/bin/env python
# coding: utf-8

import os
import sys

import web
import daemon
import gflags
import logging

from pygaga.helpers.logger import log_init
from pygaga.helpers.webutils import file_env, render_to_string, render_html

logger = logging.getLogger('WebLogger')

FLAGS = gflags.FLAGS

file_path = os.path.split(os.path.abspath(__file__))[0]

ENV = file_env(file_path)

urls = (
'/', 'home',
)
def my_filter(input):
return input

ENV.filters['my_filter'] = my_filter

class home:
def GET(self):
return 'test'

if __name__ == "__main__":
# usage: ${prog} ip:port --daemon --stderr ...
gflags.DEFINE_boolean('daemon', False, "is start in daemon mode?")
gflags.DEFINE_boolean('webdebug', False, "is web.py debug")
gflags.DEFINE_boolean('reload', False, "is web.py reload app")
backup_args = []
backup_args.extend(sys.argv)
sys.argv = [sys.argv[0],] + sys.argv[2:]
log_init('WebLogger', "sqlalchemy.*")
sys.argv = backup_args[:2]
web.config.debug = FLAGS.webdebug
if len(sys.argv) == 1:
web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
if FLAGS.daemon:
daemon.daemonize(os.path.join(file_path, 'web.pid'))
#render = web.template.render('templates/', base='layout')
app = web.application(urls, globals(), autoreload=FLAGS.reload)
app.run()

</string>
<key>name</key>
<string>new web.py template</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>web</string>
<key>uuid</key>
<string>1B403321-EC35-49D6-8756-F80C630150B4</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Snippets/gflags boolean.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>gflags.DEFINE_boolean('$1', ${2:False}, "$3")</string>
<key>name</key>
<string>gflags define boolean</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>gbool</string>
<key>uuid</key>
<string>1BBE1C85-C581-473D-BCE5-98292408FEA2</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Snippets/gflags enum.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>gflags.DEFINE_enum('$1', '$2', ['$2',], "$3")</string>
<key>name</key>
<string>gflags define enum</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>genum</string>
<key>uuid</key>
<string>6B2EB187-5CEF-4FBC-8517-AE2E7E3E06EB</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Snippets/gflags integer.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>gflags.DEFINE_integer('$1', ${2:0}, "$3")</string>
<key>name</key>
<string>gflags define int</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>gint</string>
<key>uuid</key>
<string>41744546-5DA7-46AD-81BC-B9B61220893D</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Snippets/gflags list.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>gflags.DEFINE_list('$1', [], "$2")</string>
<key>name</key>
<string>gflags define list</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>glist</string>
<key>uuid</key>
<string>481C41D8-A1AA-47A7-8482-F7E2785B8273</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Snippets/gflags string.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>gflags.DEFINE_string('$1', '$2', "$3")</string>
<key>name</key>
<string>gflags define string</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>gstr</string>
<key>uuid</key>
<string>490E6BBD-0075-4BA7-BC5B-B26D5796D956</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Snippets/pdb trace.tmSnippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>import pdb; pdb.set_trace()</string>
<key>name</key>
<string>pdb.set_trace</string>
<key>scope</key>
<string>source.python</string>
<key>tabTrigger</key>
<string>pdb</string>
<key>uuid</key>
<string>A2BDCF66-4607-4304-B3FE-B2F30E08E4E1</string>
</dict>
</plist>