notepad

Check-in [45b60e7948]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Utility in support of global notes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | master | trunk
Files: files | file ages | folders
SHA3-256:45b60e7948623e8db1c298d4b06ec4fbf374fcd192c8ce3888d1ebd14b01be56
User & Date: vandys 2019-02-10 18:54:22
Context
2019-02-10
18:54
Utility in support of global notes Leaf check-in: 45b60e7948 user: vandys tags: master, trunk
2019-02-06
18:53
First pass, global notes. It's easy to forget to manually sync, gotta think about that... check-in: 1ec9053e4d user: vandys tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added setglobal.py.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
# setglobal.py
#	Make a note appear to all users
#
# Usage:
#   setglobal.py "<user>" "<title>"
#
import sys
import sqlite3
from config import DBNAME

# Connect to DB
conn = sqlite3.connect("var/" + DBNAME)

GlobalNotes = set()
c = conn.cursor()

# Look up key
user = sys.argv[1]
title = sys.argv[2]
c.execute('select key form notes where user="%s" and title="%s" %
    (user, title))
tup = c.fetchone()
if tup is None:
    sys.stderr.write("Can't find note title '%s' for user '%s'\n" %
	(title, user))
    sys.exit(1)
key = tup[0]

# Update user to "*"
c.execute('update notes set user="*" where key="%s"' % (key,))

conn.commit()
conn.close()

sys.exit(0)