Re: [tw5] Re: Easy local saving with Python

2020-12-23 Thread Mohammad Rahmani
Hi Gurudeep,
May be something like the small saver like what Nathan shared above.


Best wishes
Mohammad


On Wed, Dec 23, 2020 at 1:10 PM Gurudeep Rao  wrote:

> Hey Mohammad,
>
> Yeah it does not save ootb, but I was trying something to see if we can
> write a minimal Python module that does it or store the json in TinyDB
>
> On Mon, 21 Dec 2020 at 22:53, Mohammad Rahmani 
> wrote:
>
>> Hi Gurudeep,
>> Many thanks for sharing. Eel is an amazing tool and has a lot of
>> potential to integrate Tiddlywiki with Python.
>> I just made some experiments. For me it does not save Tiddlywiki out of
>> the box!
>>
>> Best wishes
>> Mohammad
>>
>>
>> On Mon, Dec 21, 2020 at 2:12 PM Gurudeep Rao 
>> wrote:
>>
>>> @UBI, @Mohammad,
>>>
>>> This might interest you,
>>> Python Eel Project
>>> 
>>>
>>> On Sunday, 27 September, 2020 at 1:02:52 am UTC+5:30 PMario wrote:
>>>
 Hi Nathan,

 I think, you should have started your own thread. IMO it deserves it.

 have fun!
 mario

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "TiddlyWiki" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to tiddlywiki+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tiddlywiki/8f03ef81-c7cc-49fc-b5d3-99dfb7bffe41n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/M64suMWXDYQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> tiddlywiki+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAjwmuSSEBcbQYFoZBWbjHQnrhziSha8TqtEoXvDHJrQg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/CAHXc%3DbHNUbRX_K-8BU_jBAyEBQu0ixFT4w8oBV2e7FW0A8PPYA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMDLMocJr3Ybo2AuLptZdrrsa_swe1_WWR3S7Cgrruh6uA%40mail.gmail.com.


Re: [tw5] Re: Easy local saving with Python

2020-12-23 Thread Gurudeep Rao
Hey Mohammad,

Yeah it does not save ootb, but I was trying something to see if we can
write a minimal Python module that does it or store the json in TinyDB

On Mon, 21 Dec 2020 at 22:53, Mohammad Rahmani 
wrote:

> Hi Gurudeep,
> Many thanks for sharing. Eel is an amazing tool and has a lot of potential
> to integrate Tiddlywiki with Python.
> I just made some experiments. For me it does not save Tiddlywiki out of
> the box!
>
> Best wishes
> Mohammad
>
>
> On Mon, Dec 21, 2020 at 2:12 PM Gurudeep Rao 
> wrote:
>
>> @UBI, @Mohammad,
>>
>> This might interest you,
>> Python Eel Project
>> 
>>
>> On Sunday, 27 September, 2020 at 1:02:52 am UTC+5:30 PMario wrote:
>>
>>> Hi Nathan,
>>>
>>> I think, you should have started your own thread. IMO it deserves it.
>>>
>>> have fun!
>>> mario
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "TiddlyWiki" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to tiddlywiki+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/8f03ef81-c7cc-49fc-b5d3-99dfb7bffe41n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tiddlywiki/M64suMWXDYQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAjwmuSSEBcbQYFoZBWbjHQnrhziSha8TqtEoXvDHJrQg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAHXc%3DbHNUbRX_K-8BU_jBAyEBQu0ixFT4w8oBV2e7FW0A8PPYA%40mail.gmail.com.


Re: [tw5] Re: Easy local saving with Python

2020-12-21 Thread Mohammad Rahmani
Hi Gurudeep,
Many thanks for sharing. Eel is an amazing tool and has a lot of potential
to integrate Tiddlywiki with Python.
I just made some experiments. For me it does not save Tiddlywiki out of the
box!

Best wishes
Mohammad


On Mon, Dec 21, 2020 at 2:12 PM Gurudeep Rao  wrote:

> @UBI, @Mohammad,
>
> This might interest you,
> Python Eel Project
> 
>
> On Sunday, 27 September, 2020 at 1:02:52 am UTC+5:30 PMario wrote:
>
>> Hi Nathan,
>>
>> I think, you should have started your own thread. IMO it deserves it.
>>
>> have fun!
>> mario
>>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/8f03ef81-c7cc-49fc-b5d3-99dfb7bffe41n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAjwmuSSEBcbQYFoZBWbjHQnrhziSha8TqtEoXvDHJrQg%40mail.gmail.com.


[tw5] Re: Easy local saving with Python

2020-12-21 Thread Gurudeep Rao
@UBI, @Mohammad, 

This might interest you,
Python Eel Project 


On Sunday, 27 September, 2020 at 1:02:52 am UTC+5:30 PMario wrote:

> Hi Nathan, 
>
> I think, you should have started your own thread. IMO it deserves it. 
>
> have fun!
> mario
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8f03ef81-c7cc-49fc-b5d3-99dfb7bffe41n%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-09-26 Thread PMario
Hi Nathan, 

I think, you should have started your own thread. IMO it deserves it. 

have fun!
mario

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8a312080-eb8e-489a-ba40-f508fe11feb5o%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-09-26 Thread Nathan Warner
Hi all, wanted to share a python server project I worked 
on. https://github.com/itsamenathan/tiddlysaver-python

On Tuesday, January 21, 2020 at 2:37:41 AM UTC-7 tony wrote:

> Thank you UBi!
>
> So refreshing to have alternatives.
>
> Tested and works under Debian Linux via ChromeOs in an inexpensive 
> Chromebook running Crostini 
> 
>
> and timely given the future status of Chrome Apps 
>  
> potentially affecting TiddlyChrome and/or TiddlyDrive
>
> Best,
> tony
>
>
> On Sunday, December 29, 2019 at 10:15:16 AM UTC-8, UBi wrote:
>>
>> Hi again,
>>
>> here is a slightly improved version of twserver.py (moved timestamp 
>> before .html in backup file names, tidied code).
>>
>> #!/usr/bin/python3
>>
>> import datetime, shutil, os, http.server
>>
>> def makebackup(src):
>> (srcpath, srcfile) = os.path.split(src)
>> (srcname, src_ext) = os.path.splitext(srcfile)
>> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
>> dstpath = os.path.join(srcpath,'twBackups')
>> if not os.path.exists(dstpath):
>> os.mkdir(dstpath)
>> shutil.copyfile(src, os.path.join(dstpath, srcname+'-'+tstamp+src_ext
>> ))
>>
>> class ExtendedHandler(http.server.SimpleHTTPRequestHandler):
>> def do_OPTIONS(self):
>> self.send_response(200, 'OK')
>> self.send_header('allow',
>> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
>> self.send_header('x-api-access-type','file')
>> self.send_header('dav','tw5/put')
>> self.end_headers()
>> def do_PUT(self):
>> path = self.translate_path(self.path)
>> makebackup(path)
>> with open(path, "wb") as dst:
>> dst.write(self.rfile.read(int(self.headers['Content-Length'
>> ])))
>> self.send_response(200, 'OK')
>> self.end_headers()
>>
>> os.chdir(os.path.dirname(os.path.abspath(__file__)))
>> http.server.HTTPServer(('localhost',8080),ExtendedHandler).serve_forever
>> ()
>>
>> Like it's template, 
>> https://tiddlywiki.com/#Saving%20via%20a%20Minimal%20Ruby%20Server, it 
>> covers only the bare minimum TW server needs.
>> Feel free to use it / customise it at will.
>>
>> Am Samstag, 28. Dezember 2019 17:52:43 UTC+1 schrieb UBi:
>>>
>>> Hello,
>>>
>>> I had some spare time recently, so I tried to re-implement the Ruby 
>>> Server in Python:
>>>
>>> #!/usr/bin/python3
>>>
>>> from http.server import SimpleHTTPRequestHandler, HTTPServer
>>> import datetime, shutil, os
>>>
>>> def makebackup(src):
>>> (srcpath, srcfile) = os.path.split(src)
>>> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
>>> dstpath = os.path.join(srcpath,'twBackups')
>>> if not os.path.exists(dstpath):
>>> os.mkdir(dstpath)
>>> shutil.copyfile(src, os.path.join(dstpath, srcfile+'.'+tstamp))
>>>
>>> class ExtendedHandler(SimpleHTTPRequestHandler):
>>> def do_OPTIONS(self):
>>> self.send_response(200, 'OK')
>>> self.send_header('allow',
>>> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
>>> self.send_header('x-api-access-type','file')
>>> self.send_header('dav','tw5/put')
>>> self.end_headers()
>>> def do_PUT(self):
>>> length = int(self.headers['Content-Length'])
>>> path = self.translate_path(self.path)
>>> makebackup(path)
>>> with open(path, "wb") as dst:
>>> dst.write(self.rfile.read(length))
>>> self.send_response(200, 'OK')
>>> self.send_header('Content-Type', 'text/html')
>>> self.end_headers()
>>>
>>> os.chdir(os.path.dirname(os.path.abspath(__file__)))
>>> HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>>>
>>> It works for me :-)
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d0423f5c-d186-4448-a19f-39933ad50a56n%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-21 Thread tony
Thank you UBi!

So refreshing to have alternatives.

Tested and works under Debian Linux via ChromeOs in an inexpensive 
Chromebook running Crostini 


and timely given the future status of Chrome Apps 
 
potentially affecting TiddlyChrome and/or TiddlyDrive

Best,
tony


On Sunday, December 29, 2019 at 10:15:16 AM UTC-8, UBi wrote:
>
> Hi again,
>
> here is a slightly improved version of twserver.py (moved timestamp before 
> .html in backup file names, tidied code).
>
> #!/usr/bin/python3
>
> import datetime, shutil, os, http.server
>
> def makebackup(src):
> (srcpath, srcfile) = os.path.split(src)
> (srcname, src_ext) = os.path.splitext(srcfile)
> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
> dstpath = os.path.join(srcpath,'twBackups')
> if not os.path.exists(dstpath):
> os.mkdir(dstpath)
> shutil.copyfile(src, os.path.join(dstpath, srcname+'-'+tstamp+src_ext
> ))
>
> class ExtendedHandler(http.server.SimpleHTTPRequestHandler):
> def do_OPTIONS(self):
> self.send_response(200, 'OK')
> self.send_header('allow',
> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
> self.send_header('x-api-access-type','file')
> self.send_header('dav','tw5/put')
> self.end_headers()
> def do_PUT(self):
> path = self.translate_path(self.path)
> makebackup(path)
> with open(path, "wb") as dst:
> dst.write(self.rfile.read(int(self.headers['Content-Length'
> ])))
> self.send_response(200, 'OK')
> self.end_headers()
>
> os.chdir(os.path.dirname(os.path.abspath(__file__)))
> http.server.HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>
> Like it's template, 
> https://tiddlywiki.com/#Saving%20via%20a%20Minimal%20Ruby%20Server, it 
> covers only the bare minimum TW server needs.
> Feel free to use it / customise it at will.
>
> Am Samstag, 28. Dezember 2019 17:52:43 UTC+1 schrieb UBi:
>>
>> Hello,
>>
>> I had some spare time recently, so I tried to re-implement the Ruby 
>> Server in Python:
>>
>> #!/usr/bin/python3
>>
>> from http.server import SimpleHTTPRequestHandler, HTTPServer
>> import datetime, shutil, os
>>
>> def makebackup(src):
>> (srcpath, srcfile) = os.path.split(src)
>> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
>> dstpath = os.path.join(srcpath,'twBackups')
>> if not os.path.exists(dstpath):
>> os.mkdir(dstpath)
>> shutil.copyfile(src, os.path.join(dstpath, srcfile+'.'+tstamp))
>>
>> class ExtendedHandler(SimpleHTTPRequestHandler):
>> def do_OPTIONS(self):
>> self.send_response(200, 'OK')
>> self.send_header('allow',
>> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
>> self.send_header('x-api-access-type','file')
>> self.send_header('dav','tw5/put')
>> self.end_headers()
>> def do_PUT(self):
>> length = int(self.headers['Content-Length'])
>> path = self.translate_path(self.path)
>> makebackup(path)
>> with open(path, "wb") as dst:
>> dst.write(self.rfile.read(length))
>> self.send_response(200, 'OK')
>> self.send_header('Content-Type', 'text/html')
>> self.end_headers()
>>
>> os.chdir(os.path.dirname(os.path.abspath(__file__)))
>> HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>>
>> It works for me :-)
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/177f244a-de24-4341-8dd9-b63901a782a2%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-17 Thread Mohammad
Panos,

 It works fine! Thank you.

- Windows 10 + Python 3.7 + Chrome 79

-Configuration: localhost, no Git, no authentication, no https.


I like to know how it is configured for Git!


--Mohammad

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/98e75f75-374e-4476-8f5b-dbfd15687802%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-17 Thread Mohammad
Sure,
 I will return to you soon!

--Mohammad

On Friday, January 17, 2020 at 2:10:00 PM UTC+3:30, Panos Firbas wrote:
>
> Hi Mohammad,
>
> I found some time today to have another look at it, would you give it 
> another shot please?
>
> On Tuesday, January 14, 2020 at 7:21:48 PM UTC+1, Mohammad wrote:
>>
>> Hi again Panos,
>>
>> No success. The error has been given below
>> OS: Win10
>> Python 3.7
>>
>> $ python tiddlyserver.py
>> 127.0.0.1 - - [14/Jan/2020 21:50:11] "GET /empty.html HTTP/1.1" 304 -
>> 127.0.0.1 - - [14/Jan/2020 21:50:11] "OPTIONS /empty.html HTTP/1.1" 200 -
>> 
>> Exception happened during processing of request from ('127.0.0.1', 49777)
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>>  
>> line 316, in _handle_request_noblock
>> self.process_request(request, client_address)
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>>  
>> line 347, in process_request
>> self.finish_request(request, client_address)
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>>  
>> line 360, in finish_request
>> self.RequestHandlerClass(request, client_address, self)
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py",
>>  
>> line 646, in __init__
>> super().__init__(*args, **kwargs)
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>>  
>> line 720, in __init__
>> self.handle()
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py",
>>  
>> line 426, in handle
>> self.handle_one_request()
>>   File 
>> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py",
>>  
>> line 414, in handle_one_request
>> method()
>>   File "tiddlyserver.py", line 91, in do_PUT
>> makebackup(path)
>>   File "tiddlyserver.py", line 73, in makebackup
>> if int(args.VOCAL) >0:
>> NameError: name 'args' is not defined
>>
>>
>> --Mohammad
>> On Tuesday, January 14, 2020 at 6:58:22 PM UTC+3:30, Panos Firbas wrote:
>>>
>>> Hey Mohammad,   
>>>
>>> Thank you for trying it out! Well this was embarassing(ly simple to 
>>> fix).. it should be fixed, would you be kind enough to give it another shot 
>>> ?
>>>  
>>> Cheers,
>>> Panos
>>>
>>>
>>>
>>>
>>> On Tuesday, January 14, 2020 at 4:13:35 PM UTC+1, Mohammad wrote:

 Hi Panos,
  Having the latest Python Server with (no authentication, no Git, no 
 https) I get the following error when I push the save button or when TW 
 saves automatically


 Exception happened during processing of request from ('127.0.0.1', 
 56450)
 Traceback (most recent call last):
   File "D:\Python\Python37\lib\socketserver.py", line 316, in 
 _handle_request_noblock
 self.process_request(request, client_address)
   File "D:\Python\Python37\lib\socketserver.py", line 347, in 
 process_request
 self.finish_request(request, client_address)
   File "D:\Python\Python37\lib\socketserver.py", line 360, in 
 finish_request
 self.RequestHandlerClass(request, client_address, self)
   File "D:\Python\Python37\lib\http\server.py", line 646, in __init__
 super().__init__(*args, **kwargs)
   File "D:\Python\Python37\lib\socketserver.py", line 720, in __init__
 self.handle()
   File "D:\Python\Python37\lib\http\server.py", line 426, in handle
 self.handle_one_request()
   File "D:\Python\Python37\lib\http\server.py", line 414, in 
 handle_one_request
 method()
   File "tiddlyserver.py", line 91, in do_PUT
 makebackup(path)
   File "tiddlyserver.py", line 73, in makebackup
 if int(self.args.VOCAL) >0:
 NameError: name 'self' is not defined



 --Mohammad

 On Thursday, January 2, 2020 at 11:00:19 PM UTC+3:30, Panos Firbas 
 wrote:
>
> Hey all, 
>   
> I made some more updates on the server:   
> You can now turn off the extra features (https, user auth, git) from 
> the configuration file, and it can print some reporting on the command 
> line. 
>
> 
>
> @TonyM, are you adding a reference in tiddlywiki.com? Should I pm 
> Jeremy myself?
>
>
> Cheers,
> Panos
>


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c3ab91f1-35e6-4b52-9744-8494996c4011%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-17 Thread Panos Firbas
Hi Mohammad,

I found some time today to have another look at it, would you give it 
another shot please?

On Tuesday, January 14, 2020 at 7:21:48 PM UTC+1, Mohammad wrote:
>
> Hi again Panos,
>
> No success. The error has been given below
> OS: Win10
> Python 3.7
>
> $ python tiddlyserver.py
> 127.0.0.1 - - [14/Jan/2020 21:50:11] "GET /empty.html HTTP/1.1" 304 -
> 127.0.0.1 - - [14/Jan/2020 21:50:11] "OPTIONS /empty.html HTTP/1.1" 200 -
> 
> Exception happened during processing of request from ('127.0.0.1', 49777)
> Traceback (most recent call last):
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>  
> line 316, in _handle_request_noblock
> self.process_request(request, client_address)
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>  
> line 347, in process_request
> self.finish_request(request, client_address)
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>  
> line 360, in finish_request
> self.RequestHandlerClass(request, client_address, self)
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py",
>  
> line 646, in __init__
> super().__init__(*args, **kwargs)
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py",
>  
> line 720, in __init__
> self.handle()
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py",
>  
> line 426, in handle
> self.handle_one_request()
>   File 
> "C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py",
>  
> line 414, in handle_one_request
> method()
>   File "tiddlyserver.py", line 91, in do_PUT
> makebackup(path)
>   File "tiddlyserver.py", line 73, in makebackup
> if int(args.VOCAL) >0:
> NameError: name 'args' is not defined
>
>
> --Mohammad
> On Tuesday, January 14, 2020 at 6:58:22 PM UTC+3:30, Panos Firbas wrote:
>>
>> Hey Mohammad,   
>>
>> Thank you for trying it out! Well this was embarassing(ly simple to 
>> fix).. it should be fixed, would you be kind enough to give it another shot 
>> ?
>>  
>> Cheers,
>> Panos
>>
>>
>>
>>
>> On Tuesday, January 14, 2020 at 4:13:35 PM UTC+1, Mohammad wrote:
>>>
>>> Hi Panos,
>>>  Having the latest Python Server with (no authentication, no Git, no 
>>> https) I get the following error when I push the save button or when TW 
>>> saves automatically
>>>
>>>
>>> Exception happened during processing of request from ('127.0.0.1', 56450
>>> )
>>> Traceback (most recent call last):
>>>   File "D:\Python\Python37\lib\socketserver.py", line 316, in 
>>> _handle_request_noblock
>>> self.process_request(request, client_address)
>>>   File "D:\Python\Python37\lib\socketserver.py", line 347, in 
>>> process_request
>>> self.finish_request(request, client_address)
>>>   File "D:\Python\Python37\lib\socketserver.py", line 360, in 
>>> finish_request
>>> self.RequestHandlerClass(request, client_address, self)
>>>   File "D:\Python\Python37\lib\http\server.py", line 646, in __init__
>>> super().__init__(*args, **kwargs)
>>>   File "D:\Python\Python37\lib\socketserver.py", line 720, in __init__
>>> self.handle()
>>>   File "D:\Python\Python37\lib\http\server.py", line 426, in handle
>>> self.handle_one_request()
>>>   File "D:\Python\Python37\lib\http\server.py", line 414, in 
>>> handle_one_request
>>> method()
>>>   File "tiddlyserver.py", line 91, in do_PUT
>>> makebackup(path)
>>>   File "tiddlyserver.py", line 73, in makebackup
>>> if int(self.args.VOCAL) >0:
>>> NameError: name 'self' is not defined
>>>
>>>
>>>
>>> --Mohammad
>>>
>>> On Thursday, January 2, 2020 at 11:00:19 PM UTC+3:30, Panos Firbas wrote:

 Hey all, 
   
 I made some more updates on the server:   
 You can now turn off the extra features (https, user auth, git) from 
 the configuration file, and it can print some reporting on the command 
 line. 

 

 @TonyM, are you adding a reference in tiddlywiki.com? Should I pm 
 Jeremy myself?


 Cheers,
 Panos

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/50962b6b-ca90-439a-beab-5cc27da1ca02%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-14 Thread Mohammad
Hi again Panos,

No success. The error has been given below
OS: Win10
Python 3.7

$ python tiddlyserver.py
127.0.0.1 - - [14/Jan/2020 21:50:11] "GET /empty.html HTTP/1.1" 304 -
127.0.0.1 - - [14/Jan/2020 21:50:11] "OPTIONS /empty.html HTTP/1.1" 200 -

Exception happened during processing of request from ('127.0.0.1', 49777)
Traceback (most recent call last):
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py", 
line 316, in _handle_request_noblock
self.process_request(request, client_address)
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py", 
line 347, in process_request
self.finish_request(request, client_address)
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py", 
line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py", 
line 646, in __init__
super().__init__(*args, **kwargs)
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\socketserver.py", 
line 720, in __init__
self.handle()
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py", 
line 426, in handle
self.handle_one_request()
  File 
"C:\Users\Mohammad\AppData\Local\Programs\Python\Python37\lib\http\server.py", 
line 414, in handle_one_request
method()
  File "tiddlyserver.py", line 91, in do_PUT
makebackup(path)
  File "tiddlyserver.py", line 73, in makebackup
if int(args.VOCAL) >0:
NameError: name 'args' is not defined


--Mohammad
On Tuesday, January 14, 2020 at 6:58:22 PM UTC+3:30, Panos Firbas wrote:
>
> Hey Mohammad,   
>
> Thank you for trying it out! Well this was embarassing(ly simple to fix).. 
> it should be fixed, would you be kind enough to give it another shot ?
>  
> Cheers,
> Panos
>
>
>
>
> On Tuesday, January 14, 2020 at 4:13:35 PM UTC+1, Mohammad wrote:
>>
>> Hi Panos,
>>  Having the latest Python Server with (no authentication, no Git, no 
>> https) I get the following error when I push the save button or when TW 
>> saves automatically
>>
>>
>> Exception happened during processing of request from ('127.0.0.1', 56450)
>> Traceback (most recent call last):
>>   File "D:\Python\Python37\lib\socketserver.py", line 316, in 
>> _handle_request_noblock
>> self.process_request(request, client_address)
>>   File "D:\Python\Python37\lib\socketserver.py", line 347, in 
>> process_request
>> self.finish_request(request, client_address)
>>   File "D:\Python\Python37\lib\socketserver.py", line 360, in 
>> finish_request
>> self.RequestHandlerClass(request, client_address, self)
>>   File "D:\Python\Python37\lib\http\server.py", line 646, in __init__
>> super().__init__(*args, **kwargs)
>>   File "D:\Python\Python37\lib\socketserver.py", line 720, in __init__
>> self.handle()
>>   File "D:\Python\Python37\lib\http\server.py", line 426, in handle
>> self.handle_one_request()
>>   File "D:\Python\Python37\lib\http\server.py", line 414, in 
>> handle_one_request
>> method()
>>   File "tiddlyserver.py", line 91, in do_PUT
>> makebackup(path)
>>   File "tiddlyserver.py", line 73, in makebackup
>> if int(self.args.VOCAL) >0:
>> NameError: name 'self' is not defined
>>
>>
>>
>> --Mohammad
>>
>> On Thursday, January 2, 2020 at 11:00:19 PM UTC+3:30, Panos Firbas wrote:
>>>
>>> Hey all, 
>>>   
>>> I made some more updates on the server:   
>>> You can now turn off the extra features (https, user auth, git) from the 
>>> configuration file, and it can print some reporting on the command 
>>> line. 
>>>
>>> 
>>>
>>> @TonyM, are you adding a reference in tiddlywiki.com? Should I pm 
>>> Jeremy myself?
>>>
>>>
>>> Cheers,
>>> Panos
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/690b5048-8a44-48f8-9066-619917619dc6%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-14 Thread Panos Firbas
Hey Mohammad,   
   
Thank you for trying it out! Well this was embarassing(ly simple to fix).. 
it should be fixed, would you be kind enough to give it another shot ?
 
Cheers,
Panos




On Tuesday, January 14, 2020 at 4:13:35 PM UTC+1, Mohammad wrote:
>
> Hi Panos,
>  Having the latest Python Server with (no authentication, no Git, no 
> https) I get the following error when I push the save button or when TW 
> saves automatically
>
>
> Exception happened during processing of request from ('127.0.0.1', 56450)
> Traceback (most recent call last):
>   File "D:\Python\Python37\lib\socketserver.py", line 316, in 
> _handle_request_noblock
> self.process_request(request, client_address)
>   File "D:\Python\Python37\lib\socketserver.py", line 347, in 
> process_request
> self.finish_request(request, client_address)
>   File "D:\Python\Python37\lib\socketserver.py", line 360, in 
> finish_request
> self.RequestHandlerClass(request, client_address, self)
>   File "D:\Python\Python37\lib\http\server.py", line 646, in __init__
> super().__init__(*args, **kwargs)
>   File "D:\Python\Python37\lib\socketserver.py", line 720, in __init__
> self.handle()
>   File "D:\Python\Python37\lib\http\server.py", line 426, in handle
> self.handle_one_request()
>   File "D:\Python\Python37\lib\http\server.py", line 414, in 
> handle_one_request
> method()
>   File "tiddlyserver.py", line 91, in do_PUT
> makebackup(path)
>   File "tiddlyserver.py", line 73, in makebackup
> if int(self.args.VOCAL) >0:
> NameError: name 'self' is not defined
>
>
>
> --Mohammad
>
> On Thursday, January 2, 2020 at 11:00:19 PM UTC+3:30, Panos Firbas wrote:
>>
>> Hey all, 
>>   
>> I made some more updates on the server:   
>> You can now turn off the extra features (https, user auth, git) from the 
>> configuration file, and it can print some reporting on the command 
>> line. 
>>
>> 
>>
>> @TonyM, are you adding a reference in tiddlywiki.com? Should I pm Jeremy 
>> myself?
>>
>>
>> Cheers,
>> Panos
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9fd44e1c-5c1f-4246-9f3f-4e794c65f347%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-14 Thread Mohammad
Hi Panos,
 Having the latest Python Server with (no authentication, no Git, no https) 
I get the following error when I push the save button or when TW saves 
automatically


Exception happened during processing of request from ('127.0.0.1', 56450)
Traceback (most recent call last):
  File "D:\Python\Python37\lib\socketserver.py", line 316, in 
_handle_request_noblock
self.process_request(request, client_address)
  File "D:\Python\Python37\lib\socketserver.py", line 347, in 
process_request
self.finish_request(request, client_address)
  File "D:\Python\Python37\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "D:\Python\Python37\lib\http\server.py", line 646, in __init__
super().__init__(*args, **kwargs)
  File "D:\Python\Python37\lib\socketserver.py", line 720, in __init__
self.handle()
  File "D:\Python\Python37\lib\http\server.py", line 426, in handle
self.handle_one_request()
  File "D:\Python\Python37\lib\http\server.py", line 414, in 
handle_one_request
method()
  File "tiddlyserver.py", line 91, in do_PUT
makebackup(path)
  File "tiddlyserver.py", line 73, in makebackup
if int(self.args.VOCAL) >0:
NameError: name 'self' is not defined



--Mohammad

On Thursday, January 2, 2020 at 11:00:19 PM UTC+3:30, Panos Firbas wrote:
>
> Hey all, 
>   
> I made some more updates on the server:   
> You can now turn off the extra features (https, user auth, git) from the 
> configuration file, and it can print some reporting on the command 
> line. 
>
> 
>
> @TonyM, are you adding a reference in tiddlywiki.com? Should I pm Jeremy 
> myself?
>
>
> Cheers,
> Panos
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/595c9687-765c-4a2a-bd5b-77b03d664adb%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-02 Thread Mohammad
Hi Panos,
 This is great! Thank you!

p.s: always put the demo and code link here for people to click and open 
the code or demo page

--Mohammad

On Thursday, January 2, 2020 at 11:00:19 PM UTC+3:30, Panos Firbas wrote:
>
> Hey all, 
>   
> I made some more updates on the server:   
> You can now turn off the extra features (https, user auth, git) from the 
> configuration file, and it can print some reporting on the command 
> line. 
>
> 
>
> @TonyM, are you adding a reference in tiddlywiki.com? Should I pm Jeremy 
> myself?
>
>
> Cheers,
> Panos
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6df0bc7e-46b7-4453-982e-a1d5f040e478%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2020-01-02 Thread Panos Firbas
Hey all, 
  
I made some more updates on the server:   
You can now turn off the extra features (https, user auth, git) from the 
configuration file, and it can print some reporting on the command 
line. 


   
@TonyM, are you adding a reference in tiddlywiki.com? Should I pm Jeremy 
myself?


Cheers,
Panos

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d85e3023-8b90-4678-9d95-ba815115f84b%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread TonyM
UBi

Yes, that is well on the way. We can fill it out based on a little more 
experience.

Thanks
Tony

On Monday, December 30, 2019 at 10:05:14 PM UTC+11, UBi wrote:
>
> Do you mean something like this?
>
>- Python is a widely used multi purpose programming/scripting language 
>available for free.
>- Linux: on most Linux distributions Python is pre-installed or can be 
>added easily with the distribution specific package manager.
>- Windows: download it from https://www.python.org and install it. You 
>can safely accept the default install options. It eats up some of your 
> disk 
>space, adds new entries to your start menu, but has no impact otherwise. 
>Except that you now can create and/or run Python programs, twserver.py for 
>example.
>
> UBi
>
> Am Sonntag, 29. Dezember 2019 23:37:29 UTC+1 schrieb TonyM:
>>
>> Folks
>>
>> Can we include a simple overview for people not familiar with python and 
>> its environment? I presume you can get it for multiple os implementations 
>> and make use of it on most platforms. Does it have defaults that may clash 
>> with other local hosts or specific ports etc... Basicaly we need to provide 
>> the information people need to select it without first installing it.
>>
>> Regards
>> Tony
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4b6d5e06-57b2-4dbe-b12a-d0e7c81eea2b%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Panos Firbas
Hey Muhammad, 
 
The .service file is exclusively for linux systems no need to worry about 
it on Windows, it will do nothing. 
   
Thinking about it, if you are going to use it only on your local machine (I 
assume windows users are not looking to serve the wiki on the web), 
the features I added are not of much use. UBi's solution would be ideal for 
that, just plop the snippet in any folder you want to serve and run 
it.  

Git could be a useful feature even for local usage though, and I think I 
have an idea why it failed, it has to do with the way I call git from 
inside python 
(which of course is different on windows). I'll check for a universal 
solution tomorrow.   
   
I'll also add some reporting :)




On Tuesday, December 31, 2019 at 7:12:26 PM UTC, Mohammad wrote:
>
> Panos,
>
> For me it failed to save using git? [Windows 10 Python 3.7.5]
>
> Question:
>
> In tiddly.service what is the working folder? Do I need to set it on 
> Windows?
>
> [Service]
> User=USER
> WorkingDirectory=/home/USER/tiddlywiki/
> ExecStart=/usr/bin/python3 /home/USER/tiddlywiki/tiddlyserver.py
> Restart=always
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b788ec74-436a-422c-a786-7c028e25ab4d%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
@UBi,

Please put this Python Server somewhere on the net like tiddlyspot and for 
future reference!
Also I appreciate if you kindly add the description and how to use notes to 
that wiki!
As TT said your solution for localhost is a very simple to use and 
understand!
Your idea got a lot of attention!

--Mohammad

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/71833a9f-af0e-47a0-b5de-e1261da5ee1d%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
More comments:

It is good user knows the server has been successfully started

like

print("Tiddlyserver started ...")
theserver.serve_forever()

Produces on Windows 10, Python 3.7.5


Mohammad@N550JK C:\Temp
$ python tiddlyserver.py
Tiddlyserver started ...

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5a71825b-8020-4930-8d50-05171e20b75a%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
Panos,

For me it hailed to save using git? [Windows 10 Python 3.7.5]

Question:

In tiddly.service what is the working folder? Do I need to set it on 
Windows?

[Service]
User=USER
WorkingDirectory=/home/USER/tiddlywiki/
ExecStart=/usr/bin/python3 /home/USER/tiddlywiki/tiddlyserver.py
Restart=always

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ecee39e7-4b8c-42f9-9167-35912d4fcea0%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
Hi Panos,

On Tuesday, December 31, 2019 at 10:28:20 PM UTC+3:30, Panos Firbas wrote:
>
> Hey Mohammad, 
>   
> > Is it possible on server start launch a wiki to act as the landing page 
> and from there I could click any wiki I like to open  
> 
> If you have a wiki named "index.html" in the served folder, the python 
> server will automatically launch that instead of the directory view.  
> The downside is that as far as I know, you cannot then revert to the 
> directory view so you will have to manually go to any other wiki.   
>  
> You would then have to maintain links to your other wikis in your main 
> wiki. I'll add a note of this in the repo.  
>
> > How serve folders located on different drive for example C:/TW, 
> D:/myNotes, ...
>
 

>
> H, I could change the served folder to be a parameter in the 
> configuration file instead of defaulting to ./served, this way the server 
> could easily serve any single folder.
> I'd have to also make sure that git is initialized in gitless folders but 
> that shouldn't be too hard.  
>
> Serving multiple folders sounds a bit more challenging... I could symlink 
> a bunch of folders into one, but then I'm not sure how to handle the git 
> issue.
>
> With regards to windows support, I personally don't have a windows machine 
> so I can't do too much trial and error. I'd be happy to package this once 
> it's a bit more stable,
> but I think for now copy pasting the files and folder structure should be 
> easier for everyone. (git is available on windows right? They would also 
> need that for my version)
>
> Okay, I understood! lets keep it simple so I will put all my wikis in 
.served folder

There is no git pre-installed on Windows, but it can be easily installed, I 
will help later if you want to add a windows installation to repo!
Python is seamlessly installed no hassle! It is up to users, but Windows 
store may be the first choice! I personally prefer python.org distributions
 

>
> ps.  
> You got my name right the first time, it's Panos :P
> Sorry for that, I was writting from cell phone!
>
>
>
> On Tuesday, December 31, 2019 at 6:23:10 PM UTC, Mohammad wrote:
>>
>> Hi Panos,
>>  This is absolutely a great improvement! I have some minor comments:
>>
>> 1. Is it possible on server start launch a wiki to act as the landing 
>> page and from there I could click any wiki I like to open
>> 2. How serve folders located on different drive for example C:/TW, 
>> D:/myNotes, ...
>>
>> Please keep going on!
>>
>> --Mohammad
>>
>> On Tuesday, December 31, 2019 at 7:55:43 PM UTC+3:30, Panos Firbas wrote:
>>>
>>> Hello all,  
>>>
>>> Since I keep updating this, I started a little repo:
>>> https://gitlab.com/panosfirbas/tiddlyp/tree/master   
>>> 
>>> I changed the backup method to git: every time PUT is called, python 
>>> makes a system call to git to add and commit the new file.
>>> It's super basic but it works. I think this won't balloon too much, 
>>> we'll see. 
>>>   
>>> I also implemented a very basic and unsafe user authentication (trigger 
>>> warning: it stores the key in plain text).  
>>>  
>>> Finally, I put all the script options in a config file to make things a 
>>> bit cleaner.   
>>>   
>>> Please feel free to fork clone etc. etc.  
>>>   
>>> This is fun!
>>>
>>> ps.   
>>> @DonaldCoates : Yep, I like learning and I like avoiding nodejs (call me 
>>> weird but I think js should stay in the frontend) :)
>>>
>>>
>>>
>>> On Tuesday, December 31, 2019 at 1:49:02 PM UTC, Donald Coates wrote:

 I tried to push node several times on Reddit he's not biting.  :D  
 Panos you could just use the authorization of apache/nginx .  But just to 
 push node one more time it does have authorization baked in as well as the 
 ability to show a read only version and use ssl certs.

 I do understand the desire to make something work however.  That's why 
 we're here after all!

 On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:
>
> Hi Panos,
>
> your use case is definitely more network centric than mine. Maybe you 
> should consider the Node.js flavour of TiddlyWiki, and set up a 
> https://tiddlywiki.com/static/WebServer.html? The biggest 
> disadvantage, from my point of view: it's not Python :-)
>


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0a08d413-5345-4c26-bf9a-6e669ef7fb30%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread TiddlyTweeter
I think what is attractive is the apparent ease of it.

I found it simple to get running on Windows. 
Much easier than other solutions i have tried.

I'd say it is definitely something to pursue further. 

Best wishes
TT

On Tuesday, 31 December 2019 19:34:43 UTC+1, Mohammad wrote:
>
> This thread seems very hot and attracted many! In one day 216 view is a 
> record!
> So, it seems many people like Python+Tiddlywiki
>
> @Ponas and UBi
> Inform Jeremy (through a PR) to add Python Server to tiddlywiki.com
>
>
>
> --Mohammad
>
> On Tuesday, December 31, 2019 at 7:55:43 PM UTC+3:30, Panos Firbas wrote:
>>
>> Hello all,  
>>
>> Since I keep updating this, I started a little repo:
>> https://gitlab.com/panosfirbas/tiddlyp/tree/master   
>> 
>> I changed the backup method to git: every time PUT is called, python 
>> makes a system call to git to add and commit the new file.
>> It's super basic but it works. I think this won't balloon too much, we'll 
>> see. 
>>   
>> I also implemented a very basic and unsafe user authentication (trigger 
>> warning: it stores the key in plain text).  
>>  
>> Finally, I put all the script options in a config file to make things a 
>> bit cleaner.   
>>   
>> Please feel free to fork clone etc. etc.  
>>   
>> This is fun!
>>
>> ps.   
>> @DonaldCoates : Yep, I like learning and I like avoiding nodejs (call me 
>> weird but I think js should stay in the frontend) :)
>>
>>
>>
>> On Tuesday, December 31, 2019 at 1:49:02 PM UTC, Donald Coates wrote:
>>>
>>> I tried to push node several times on Reddit he's not biting.  :D  Panos 
>>> you could just use the authorization of apache/nginx .  But just to push 
>>> node one more time it does have authorization baked in as well as the 
>>> ability to show a read only version and use ssl certs.
>>>
>>> I do understand the desire to make something work however.  That's why 
>>> we're here after all!
>>>
>>> On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:

 Hi Panos,

 your use case is definitely more network centric than mine. Maybe you 
 should consider the Node.js flavour of TiddlyWiki, and set up a 
 https://tiddlywiki.com/static/WebServer.html? The biggest 
 disadvantage, from my point of view: it's not Python :-)

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/bdb42c89-849f-407f-abad-a396f26e9c55%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Panos Firbas
Hey Mohammad, 
  
> Is it possible on server start launch a wiki to act as the landing page 
and from there I could click any wiki I like to open  

If you have a wiki named "index.html" in the served folder, the python 
server will automatically launch that instead of the directory view.  
The downside is that as far as I know, you cannot then revert to the 
directory view so you will have to manually go to any other wiki.   
 
You would then have to maintain links to your other wikis in your main 
wiki. I'll add a note of this in the repo.  
   
> How serve folders located on different drive for example C:/TW, 
D:/myNotes, ...

H, I could change the served folder to be a parameter in the 
configuration file instead of defaulting to ./served, this way the server 
could easily serve any single folder.
I'd have to also make sure that git is initialized in gitless folders but 
that shouldn't be too hard.  
   
Serving multiple folders sounds a bit more challenging... I could symlink a 
bunch of folders into one, but then I'm not sure how to handle the git 
issue.
   
With regards to windows support, I personally don't have a windows machine 
so I can't do too much trial and error. I'd be happy to package this once 
it's a bit more stable,
but I think for now copy pasting the files and folder structure should be 
easier for everyone. (git is available on windows right? They would also 
need that for my version)








On Tuesday, December 31, 2019 at 6:23:10 PM UTC, Mohammad wrote:
>
> Hi Panos,
>  This is absolutely a great improvement! I have some minor comments:
>
> 1. Is it possible on server start launch a wiki to act as the landing page 
> and from there I could click any wiki I like to open
> 2. How serve folders located on different drive for example C:/TW, 
> D:/myNotes, ...
>
> Please keep going on!
>
> --Mohammad
>
> On Tuesday, December 31, 2019 at 7:55:43 PM UTC+3:30, Panos Firbas wrote:
>>
>> Hello all,  
>>
>> Since I keep updating this, I started a little repo:
>> https://gitlab.com/panosfirbas/tiddlyp/tree/master   
>> 
>> I changed the backup method to git: every time PUT is called, python 
>> makes a system call to git to add and commit the new file.
>> It's super basic but it works. I think this won't balloon too much, we'll 
>> see. 
>>   
>> I also implemented a very basic and unsafe user authentication (trigger 
>> warning: it stores the key in plain text).  
>>  
>> Finally, I put all the script options in a config file to make things a 
>> bit cleaner.   
>>   
>> Please feel free to fork clone etc. etc.  
>>   
>> This is fun!
>>
>> ps.   
>> @DonaldCoates : Yep, I like learning and I like avoiding nodejs (call me 
>> weird but I think js should stay in the frontend) :)
>>
>>
>>
>> On Tuesday, December 31, 2019 at 1:49:02 PM UTC, Donald Coates wrote:
>>>
>>> I tried to push node several times on Reddit he's not biting.  :D  Panos 
>>> you could just use the authorization of apache/nginx .  But just to push 
>>> node one more time it does have authorization baked in as well as the 
>>> ability to show a read only version and use ssl certs.
>>>
>>> I do understand the desire to make something work however.  That's why 
>>> we're here after all!
>>>
>>> On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:

 Hi Panos,

 your use case is definitely more network centric than mine. Maybe you 
 should consider the Node.js flavour of TiddlyWiki, and set up a 
 https://tiddlywiki.com/static/WebServer.html? The biggest 
 disadvantage, from my point of view: it's not Python :-)

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d278eecd-e125-4e03-bdd5-e0a01dfee76d%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
This thread seems very hot and attracted many! In one day 216 view is a 
record!
So, it seems many people like Python+Tiddlywiki

@Ponas and UBi
Inform Jeremy (through a PR) to add Python Server to tiddlywiki.com



--Mohammad

On Tuesday, December 31, 2019 at 7:55:43 PM UTC+3:30, Panos Firbas wrote:
>
> Hello all,  
>
> Since I keep updating this, I started a little repo:
> https://gitlab.com/panosfirbas/tiddlyp/tree/master   
> 
> I changed the backup method to git: every time PUT is called, python makes 
> a system call to git to add and commit the new file.
> It's super basic but it works. I think this won't balloon too much, we'll 
> see. 
>   
> I also implemented a very basic and unsafe user authentication (trigger 
> warning: it stores the key in plain text).  
>  
> Finally, I put all the script options in a config file to make things a 
> bit cleaner.   
>   
> Please feel free to fork clone etc. etc.  
>   
> This is fun!
>
> ps.   
> @DonaldCoates : Yep, I like learning and I like avoiding nodejs (call me 
> weird but I think js should stay in the frontend) :)
>
>
>
> On Tuesday, December 31, 2019 at 1:49:02 PM UTC, Donald Coates wrote:
>>
>> I tried to push node several times on Reddit he's not biting.  :D  Panos 
>> you could just use the authorization of apache/nginx .  But just to push 
>> node one more time it does have authorization baked in as well as the 
>> ability to show a read only version and use ssl certs.
>>
>> I do understand the desire to make something work however.  That's why 
>> we're here after all!
>>
>> On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:
>>>
>>> Hi Panos,
>>>
>>> your use case is definitely more network centric than mine. Maybe you 
>>> should consider the Node.js flavour of TiddlyWiki, and set up a 
>>> https://tiddlywiki.com/static/WebServer.html? The biggest disadvantage, 
>>> from my point of view: it's not Python :-)
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a9119964-b91e-4843-81e2-ab4ae4bb1cac%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
TT
 Python is supported by Windows 10. You can install it like you install 
Skype. It is also available on Windows store!
 For PythonServer by Ponas and UBi, the best is to distribute it as pypi!
just pip it and it will be at your access.
Ponas and UBi can add a short paragraph to teach who are not familiar with 
Python.

--Mohammad


On Tuesday, December 31, 2019 at 7:02:17 PM UTC+3:30, TiddlyTweeter wrote:
>
> Mark S. wrote:
>>
>> There is an installer utility (maybe more than one) that will wrap your 
>> script into it's own windows executable. The thing is, it won't be 
>> certified, so may ring alarm bells. In that sense, it may be easier to 
>> install python which (I assume) will have been certified.
>>
>
> Good point. I wonder how difficult it would be to certify a bespoke 
> "package"?
>
> Best wishes
> TT
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e7a692ea-de9f-4425-86ea-c260343e98b6%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Mohammad
Hi Panos,
 This is absolutely a great improvement! I have some minor comments:

1. Is it possible on server start launch a wiki to act as the landing page 
and from there I could click any wiki I like to open
2. How serve folders located on different drive for example C:/TW, 
D:/myNotes, ...

Please keep going on!

--Mohammad

On Tuesday, December 31, 2019 at 7:55:43 PM UTC+3:30, Panos Firbas wrote:
>
> Hello all,  
>
> Since I keep updating this, I started a little repo:
> https://gitlab.com/panosfirbas/tiddlyp/tree/master   
> 
> I changed the backup method to git: every time PUT is called, python makes 
> a system call to git to add and commit the new file.
> It's super basic but it works. I think this won't balloon too much, we'll 
> see. 
>   
> I also implemented a very basic and unsafe user authentication (trigger 
> warning: it stores the key in plain text).  
>  
> Finally, I put all the script options in a config file to make things a 
> bit cleaner.   
>   
> Please feel free to fork clone etc. etc.  
>   
> This is fun!
>
> ps.   
> @DonaldCoates : Yep, I like learning and I like avoiding nodejs (call me 
> weird but I think js should stay in the frontend) :)
>
>
>
> On Tuesday, December 31, 2019 at 1:49:02 PM UTC, Donald Coates wrote:
>>
>> I tried to push node several times on Reddit he's not biting.  :D  Panos 
>> you could just use the authorization of apache/nginx .  But just to push 
>> node one more time it does have authorization baked in as well as the 
>> ability to show a read only version and use ssl certs.
>>
>> I do understand the desire to make something work however.  That's why 
>> we're here after all!
>>
>> On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:
>>>
>>> Hi Panos,
>>>
>>> your use case is definitely more network centric than mine. Maybe you 
>>> should consider the Node.js flavour of TiddlyWiki, and set up a 
>>> https://tiddlywiki.com/static/WebServer.html? The biggest disadvantage, 
>>> from my point of view: it's not Python :-)
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3753555c-b385-477c-9327-4d77c6ff2430%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Panos Firbas
Hello all,  
   
Since I keep updating this, I started a little repo:
https://gitlab.com/panosfirbas/tiddlyp/tree/master   

I changed the backup method to git: every time PUT is called, python makes 
a system call to git to add and commit the new file.
It's super basic but it works. I think this won't balloon too much, we'll 
see. 
  
I also implemented a very basic and unsafe user authentication (trigger 
warning: it stores the key in plain text).  
 
Finally, I put all the script options in a config file to make things a bit 
cleaner.   
  
Please feel free to fork clone etc. etc.  
  
This is fun!

ps.   
@DonaldCoates : Yep, I like learning and I like avoiding nodejs (call me 
weird but I think js should stay in the frontend) :)



On Tuesday, December 31, 2019 at 1:49:02 PM UTC, Donald Coates wrote:
>
> I tried to push node several times on Reddit he's not biting.  :D  Panos 
> you could just use the authorization of apache/nginx .  But just to push 
> node one more time it does have authorization baked in as well as the 
> ability to show a read only version and use ssl certs.
>
> I do understand the desire to make something work however.  That's why 
> we're here after all!
>
> On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:
>>
>> Hi Panos,
>>
>> your use case is definitely more network centric than mine. Maybe you 
>> should consider the Node.js flavour of TiddlyWiki, and set up a 
>> https://tiddlywiki.com/static/WebServer.html? The biggest disadvantage, 
>> from my point of view: it's not Python :-)
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f3884755-4438-47b1-9171-c196ddacbc1a%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread TiddlyTweeter
Mark S. wrote:
>
> There is an installer utility (maybe more than one) that will wrap your 
> script into it's own windows executable. The thing is, it won't be 
> certified, so may ring alarm bells. In that sense, it may be easier to 
> install python which (I assume) will have been certified.
>

Good point. I wonder how difficult it would be to certify a bespoke 
"package"?

Best wishes
TT

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/223b1b8d-cab4-40a0-85e5-1d5bf897bf07%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread 'Mark S.' via TiddlyWiki

There is an installer utility (maybe more than one) that will wrap your 
script into it's own windows executable. The thing is, it won't be 
certified, so may ring alarm bells. In that sense, it may be easier to 
install python which (I assume) will have been certified.

On Monday, December 30, 2019 at 2:31:05 PM UTC-8, TiddlyTweeter wrote:
>
> Mohammad wrote:
>
>> As there is a crowd of Windows user, as I explained above the backup 
>> folder can be set by user in a simple way!
>>
>
> What I find interesting is that once installed Python is quite easy to 
> configure on Windows, as far as I can see.
>
> For Windows users I'm wondering if we could package together a python 
> system and TiddlyWikis as a bundle??
>
> Seamless install of wiki with built in save is a bit like the Holy Grail, 
> but I think worth mentioning that ultimately we want people to use TW in 
> the easiest "universal" (cross platform) way.
> Is this approach close to that?
>
> Could one wrap Python in an installer for Windows and be up and editing TW 
> immediately?
>
> Thoughts
> TT
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d59c2f73-f9e6-4007-ab6e-d500cb727e70%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread Donald Coates
I tried to push node several times on Reddit he's not biting.  :D  Panos 
you could just use the authorization of apache/nginx .  But just to push 
node one more time it does have authorization baked in as well as the 
ability to show a read only version.  

I do understand the desire to make something work however.  That's why 
we're here after all!

On Tuesday, December 31, 2019 at 7:38:12 AM UTC-5, UBi wrote:
>
> Hi Panos,
>
> your use case is definitely more network centric than mine. Maybe you 
> should consider the Node.js flavour of TiddlyWiki, and set up a 
> https://tiddlywiki.com/static/WebServer.html? The biggest disadvantage, 
> from my point of view: it's not Python :-)
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a54a3fed-18dc-4692-9d65-0122c78a426f%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread UBi
Hi Panos,

your use case is definitely more network centric than mine. Maybe you 
should consider the Node.js flavour of TiddlyWiki, and set up a 
https://tiddlywiki.com/static/WebServer.html? The biggest disadvantage, 
from my point of view: it's not Python :-)

Am Dienstag, 31. Dezember 2019 12:53:12 UTC+1 schrieb Panos Firbas:
>
> Hi UBi, 
>
> Regarding *the cleanup mechanism*, please be advised that it *needs to be 
> updated* (I realized this last night before falling asleep, I'll be 
> fixing it now): as it is now, it  will delete any backups that STARTSWITH 
> the string of the current file (i.e. if you're working on "empty.html" and 
> there's a previous "emptyXXX.html" backup, the "emptyXXX" will be deleted!! 
> bad design, sorry for that !).
>   
> Regarding my choices, the important difference is that I wanted to host my 
> tiddly on a remote machine. This way I can access it from any computer I am 
> on (I have at least 4 machines that I would be wanting to open my notes 
> from, including my phone). So ssl makes things a bit safer, and automatic 
> startup makes it much more hassle free.
> 
> Regarding the backups, I was considering the following: maybe we can setup 
> a git-based backup function? Instead of just saving a new backup file, we 
> can overwrite the file in a backup folder and then call a simple git add 
> git commit on that folder? (It's pretty simple in python). This way the 
> size won't balloon and it should be safe to revert to any previous state.
> What do you think?   
>
> You are right about the backup folder as it is now, not exactly sure why I 
> didn't want to serve it.
>  
> One more thing I'll be looking into is implementing some sort of 
> rudimentary authentication on the server. If I understand right, anyone who 
> stumbles upon my server's tiddly can change it now.  
>   
> Regarding Windows and python ans stuff, maybe we can package the 
> tiddlyserver in a pypi package so that people can just install python and 
> then "pip install tiddlyserver"?   
> That should be simple enough, Does windows python come with pip? I assume 
> it would 
> 
> Cheers, I'll be back later with today's updates 
>
>
>
> On Tuesday, December 31, 2019 at 9:55:22 AM UTC, UBi wrote:
>>
>> Hi Panos,
>>
>> I'm glad that people play around with my script, and adopt it to their 
>> needs. I was thinking about a cleanup mechanism, too. Now I can take yours. 
>> I like open source :-)
>>
>> Regarding your implementation, I have two questions:
>> 1) Why do you want the user not to see the backup directory? With it 
>> being visible, an user could simply open an archived TiddlyWiki for 
>> reference without leaving the browser.
>> 2) What is the benefit of using SSL on localhost?
>>
>> Regarding automatic startup: I made the script executable (chmod a+x 
>> twserver.py), and added it to the Startup Applications in the Mate Control 
>> Center (I'm using Debian with Mate Desktop). Your systemctl solution has 
>> the advantage of being Desktop Environment agnostic, but might be slightly 
>> more complicated to implement (root access).
>>
>> UBi
>>
>> Am Montag, 30. Dezember 2019 20:55:51 UTC+1 schrieb Panos Firbas:
>>>
>>> Hi all, 
>>>   
>>> I fiddled with the script a bit today for my personal use, and since 
>>> this is a hot thread, I'm back to share my little improvements with 
>>> you.  
>>> I'm very new to tiddly so please advise if I should share these things 
>>> somewhere else.  
>>>  
>>> In the tiddlyserver script, I added a function to cleanup the backedup 
>>> files. It keeps the last X files (Default=5) and is triggered right after a 
>>> backup is made.
>>> I also added https functionality. 
>>>
>>> Please note that I also made a slight change in the folder structure, I 
>>> keep things at /home/user/tiddlyserver/. In there, we have the twBackups 
>>> folder,
>>> the tiddlyserver.py script, and a /served folder which contains the 
>>> .html files to be served. The motivation was to not serve the script 
>>> itself, or the backups.  
>>>   
>>> You can find the updated script here (use at your own risk, of course):
>>> https://gitlab.com/snippets/1926079
>>>  
>>>
>>> I also made a .service script to make this server a systemctl service 
>>> for linux systems that use it.
>>> You'll find instructions in the script itself, I don't know much about 
>>> these but it seems to be working like a charm on my vps   
>>> https://gitlab.com/snippets/1926082
>>>
>>> Hope you find it useful,
>>> -- Panos
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Monday, December 30, 2019 at 5:10:22 PM UTC, Mark S. wrote:

 Added under saving.

 On Monday, December 30, 2019 at 5:01:28 AM UTC-8, Mohammad wrote:
>
> To David Gifford,
>
> Please add Python Server to Tiddlywiki toolmap! It is a single html 
> 

[tw5] Re: Easy local saving with Python

2019-12-31 Thread Panos Firbas
Hi UBi, 
   
Regarding *the cleanup mechanism*, please be advised that it *needs to be 
updated* (I realized this last night before falling asleep, I'll be fixing 
it now): as it is now, it  will delete any backups that STARTSWITH the 
string of the current file (i.e. if you're working on "empty.html" and 
there's a previous "emptyXXX.html" backup, the "emptyXXX" will be deleted!! 
bad design, sorry for that !).
  
Regarding my choices, the important difference is that I wanted to host my 
tiddly on a remote machine. This way I can access it from any computer I am 
on (I have at least 4 machines that I would be wanting to open my notes 
from, including my phone). So ssl makes things a bit safer, and automatic 
startup makes it much more hassle free.

Regarding the backups, I was considering the following: maybe we can setup 
a git-based backup function? Instead of just saving a new backup file, we 
can overwrite the file in a backup folder and then call a simple git add 
git commit on that folder? (It's pretty simple in python). This way the 
size won't balloon and it should be safe to revert to any previous state.
What do you think?   
   
You are right about the backup folder as it is now, not exactly sure why I 
didn't want to serve it.
 
One more thing I'll be looking into is implementing some sort of 
rudimentary authentication on the server. If I understand right, anyone who 
stumbles upon my server's tiddly can change it now.  
  
Regarding Windows and python ans stuff, maybe we can package the 
tiddlyserver in a pypi package so that people can just install python and 
then "pip install tiddlyserver"?   
That should be simple enough, Does windows python come with pip? I assume 
it would 

Cheers, I'll be back later with today's updates 



On Tuesday, December 31, 2019 at 9:55:22 AM UTC, UBi wrote:
>
> Hi Panos,
>
> I'm glad that people play around with my script, and adopt it to their 
> needs. I was thinking about a cleanup mechanism, too. Now I can take yours. 
> I like open source :-)
>
> Regarding your implementation, I have two questions:
> 1) Why do you want the user not to see the backup directory? With it being 
> visible, an user could simply open an archived TiddlyWiki for reference 
> without leaving the browser.
> 2) What is the benefit of using SSL on localhost?
>
> Regarding automatic startup: I made the script executable (chmod a+x 
> twserver.py), and added it to the Startup Applications in the Mate Control 
> Center (I'm using Debian with Mate Desktop). Your systemctl solution has 
> the advantage of being Desktop Environment agnostic, but might be slightly 
> more complicated to implement (root access).
>
> UBi
>
> Am Montag, 30. Dezember 2019 20:55:51 UTC+1 schrieb Panos Firbas:
>>
>> Hi all, 
>>   
>> I fiddled with the script a bit today for my personal use, and since this 
>> is a hot thread, I'm back to share my little improvements with you.  
>> I'm very new to tiddly so please advise if I should share these things 
>> somewhere else.  
>>  
>> In the tiddlyserver script, I added a function to cleanup the backedup 
>> files. It keeps the last X files (Default=5) and is triggered right after a 
>> backup is made.
>> I also added https functionality. 
>>
>> Please note that I also made a slight change in the folder structure, I 
>> keep things at /home/user/tiddlyserver/. In there, we have the twBackups 
>> folder,
>> the tiddlyserver.py script, and a /served folder which contains the .html 
>> files to be served. The motivation was to not serve the script itself, or 
>> the backups.  
>>   
>> You can find the updated script here (use at your own risk, of course):
>> https://gitlab.com/snippets/1926079
>>  
>>
>> I also made a .service script to make this server a systemctl service for 
>> linux systems that use it.
>> You'll find instructions in the script itself, I don't know much about 
>> these but it seems to be working like a charm on my vps   
>> https://gitlab.com/snippets/1926082
>>
>> Hope you find it useful,
>> -- Panos
>>
>>
>>
>>
>>
>>
>> On Monday, December 30, 2019 at 5:10:22 PM UTC, Mark S. wrote:
>>>
>>> Added under saving.
>>>
>>> On Monday, December 30, 2019 at 5:01:28 AM UTC-8, Mohammad wrote:

 To David Gifford,

 Please add Python Server to Tiddlywiki toolmap! It is a single html 
 file saver

 --Mohammad

 On Sunday, December 29, 2019 at 11:14:37 AM UTC+3:30, Mohammad wrote:
>
> Added to TW-Scripts.
>
>
> https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python
>
>
> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>>
>> I will describe my use case on Linux, Windows should work in a 
>> similar fashion.
>>
>> My TiddlyWiki files live in /home/ubi/TW, 

[tw5] Re: Easy local saving with Python

2019-12-31 Thread UBi
Hi TT,

the idea of packaging a 30+ line script with a 25MB zipped Python 
distribution mad me chuckle. But then, why not?
This might work as well with the Ruby Server script and a Ruby 
distribution, to be fair.

UBi

Am Montag, 30. Dezember 2019 23:31:05 UTC+1 schrieb TiddlyTweeter:
>
> Mohammad wrote:
>
>> As there is a crowd of Windows user, as I explained above the backup 
>> folder can be set by user in a simple way!
>>
>
> What I find interesting is that once installed Python is quite easy to 
> configure on Windows, as far as I can see.
>
> For Windows users I'm wondering if we could package together a python 
> system and TiddlyWikis as a bundle??
>
> Seamless install of wiki with built in save is a bit like the Holy Grail, 
> but I think worth mentioning that ultimately we want people to use TW in 
> the easiest "universal" (cross platform) way.
> Is this approach close to that?
>
> Could one wrap Python in an installer for Windows and be up and editing TW 
> immediately?
>
> Thoughts
> TT
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/dade283b-372e-4c1a-8847-4726f2367f42%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-31 Thread UBi
Hi Panos,

I'm glad that people play around with my script, and adopt it to their 
needs. I was thinking about a cleanup mechanism, too. Now I can take yours. 
I like open source :-)

Regarding your implementation, I have two questions:
1) Why do you want the user not to see the backup directory? With it being 
visible, an user could simply open an archived TiddlyWiki for reference 
without leaving the browser.
2) What is the benefit of using SSL on localhost?

Regarding automatic startup: I made the script executable (chmod a+x 
twserver.py), and added it to the Startup Applications in the Mate Control 
Center (I'm using Debian with Mate Desktop). Your systemctl solution has 
the advantage of being Desktop Environment agnostic, but might be slightly 
more complicated to implement (root access).

UBi

Am Montag, 30. Dezember 2019 20:55:51 UTC+1 schrieb Panos Firbas:
>
> Hi all, 
>   
> I fiddled with the script a bit today for my personal use, and since this 
> is a hot thread, I'm back to share my little improvements with you.  
> I'm very new to tiddly so please advise if I should share these things 
> somewhere else.  
>  
> In the tiddlyserver script, I added a function to cleanup the backedup 
> files. It keeps the last X files (Default=5) and is triggered right after a 
> backup is made.
> I also added https functionality. 
>
> Please note that I also made a slight change in the folder structure, I 
> keep things at /home/user/tiddlyserver/. In there, we have the twBackups 
> folder,
> the tiddlyserver.py script, and a /served folder which contains the .html 
> files to be served. The motivation was to not serve the script itself, or 
> the backups.  
>   
> You can find the updated script here (use at your own risk, of course):
> https://gitlab.com/snippets/1926079
>  
>
> I also made a .service script to make this server a systemctl service for 
> linux systems that use it.
> You'll find instructions in the script itself, I don't know much about 
> these but it seems to be working like a charm on my vps   
> https://gitlab.com/snippets/1926082
>
> Hope you find it useful,
> -- Panos
>
>
>
>
>
>
> On Monday, December 30, 2019 at 5:10:22 PM UTC, Mark S. wrote:
>>
>> Added under saving.
>>
>> On Monday, December 30, 2019 at 5:01:28 AM UTC-8, Mohammad wrote:
>>>
>>> To David Gifford,
>>>
>>> Please add Python Server to Tiddlywiki toolmap! It is a single html file 
>>> saver
>>>
>>> --Mohammad
>>>
>>> On Sunday, December 29, 2019 at 11:14:37 AM UTC+3:30, Mohammad wrote:

 Added to TW-Scripts.


 https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python


 On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>
> I will describe my use case on Linux, Windows should work in a similar 
> fashion.
>
> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
> placed the script as twserver.py.
> For a first test, I started it manually in a terminal window:
>
> /usr/bin/python3 ~/TW/twserver.py
>>
>
> Then I pointed my browser to http://localhost:8080/. Status messages 
> started appearing in the terminal window.
>
> In the browser window a list of files and directories below ~/TW 
> appeared.
>
> I opened one of my TW files, notes.html, and created a new Tiddler. 
> The I saved the changes.
> This
> 1) backed up ~/TW/notes.html html to 
> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
> fly.
> 2) saved the changes to ~/TW/notes.html.
>
> Now I have to find out how / where I can add a call to the script to 
> my startup or login procedures.
>
> HTH UBi
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/814b3ad3-d81a-4baa-8eaa-942af15c04b2%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread TiddlyTweeter
Mohammad wrote:

> As there is a crowd of Windows user, as I explained above the backup 
> folder can be set by user in a simple way!
>

What I find interesting is that once installed Python is quite easy to 
configure on Windows, as far as I can see.

For Windows users I'm wondering if we could package together a python 
system and TiddlyWikis as a bundle??

Seamless install of wiki with built in save is a bit like the Holy Grail, 
but I think worth mentioning that ultimately we want people to use TW in 
the easiest "universal" (cross platform) way.
Is this approach close to that?

Could one wrap Python in an installer for Windows and be up and editing TW 
immediately?

Thoughts
TT

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/71abf213-2d12-4604-9688-cbe8ed8eb064%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread Mohammad


On Monday, December 30, 2019 at 11:25:51 PM UTC+3:30, Panos Firbas wrote:
>
> Hi all, 
>   
> I fiddled with the script a bit today for my personal use, and since this 
> is a hot thread, I'm back to share my little improvements with you.  
> I'm very new to tiddly so please advise if I should share these things 
> somewhere else.  
>

I think this is the right place, but you can also share on  
https://groups.google.com/forum/#!forum/tiddlywikidev

>  
> In the tiddlyserver script, I added a function to cleanup the backedup 
> files. It keeps the last X files (Default=5) and is triggered right after a 
> backup is made.
> I also added https functionality. 
>
>
This is very nice feature! I may recommend to have an option file as a json 
or simpler one to read the settings. These are backup folder, and other 
options
I think user with no or little Python knowledge can use this settings file 
easier.
 

> Please note that I also made a slight change in the folder structure, I 
> keep things at /home/user/tiddlyserver/. In there, we have the twBackups 
> folder,
> the tiddlyserver.py script, and a /served folder which contains the .html 
> files to be served. The motivation was to not serve the script itself, or 
> the backups. 
>

As there is a crowd of Windows user, as I explained above the backup folder 
can be set by user in a simple way!

Thank you for sharing and please let us know your improvements.

--Mohammad
 

>  
>   
> You can find the updated script here (use at your own risk, of course):
> https://gitlab.com/snippets/1926079
>  
>
> I also made a .service script to make this server a systemctl service for 
> linux systems that use it.
> You'll find instructions in the script itself, I don't know much about 
> these but it seems to be working like a charm on my vps   
> https://gitlab.com/snippets/1926082
>
> Hope you find it useful,
> -- Panos
>
>
>
>
>
>
> On Monday, December 30, 2019 at 5:10:22 PM UTC, Mark S. wrote:
>>
>> Added under saving.
>>
>> On Monday, December 30, 2019 at 5:01:28 AM UTC-8, Mohammad wrote:
>>>
>>> To David Gifford,
>>>
>>> Please add Python Server to Tiddlywiki toolmap! It is a single html file 
>>> saver
>>>
>>> --Mohammad
>>>
>>> On Sunday, December 29, 2019 at 11:14:37 AM UTC+3:30, Mohammad wrote:

 Added to TW-Scripts.


 https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python


 On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>
> I will describe my use case on Linux, Windows should work in a similar 
> fashion.
>
> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
> placed the script as twserver.py.
> For a first test, I started it manually in a terminal window:
>
> /usr/bin/python3 ~/TW/twserver.py
>>
>
> Then I pointed my browser to http://localhost:8080/. Status messages 
> started appearing in the terminal window.
>
> In the browser window a list of files and directories below ~/TW 
> appeared.
>
> I opened one of my TW files, notes.html, and created a new Tiddler. 
> The I saved the changes.
> This
> 1) backed up ~/TW/notes.html html to 
> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
> fly.
> 2) saved the changes to ~/TW/notes.html.
>
> Now I have to find out how / where I can add a call to the script to 
> my startup or login procedures.
>
> HTH UBi
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/93a698f3-7fcd-4869-bfd0-443a5c638f54%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread Panos Firbas
Hi all, 
  
I fiddled with the script a bit today for my personal use, and since this 
is a hot thread, I'm back to share my little improvements with you.  
I'm very new to tiddly so please advise if I should share these things 
somewhere else.  
 
In the tiddlyserver script, I added a function to cleanup the backedup 
files. It keeps the last X files (Default=5) and is triggered right after a 
backup is made.
I also added https functionality. 

Please note that I also made a slight change in the folder structure, I 
keep things at /home/user/tiddlyserver/. In there, we have the twBackups 
folder,
the tiddlyserver.py script, and a /served folder which contains the .html 
files to be served. The motivation was to not serve the script itself, or 
the backups.  
  
You can find the updated script here (use at your own risk, of course):
https://gitlab.com/snippets/1926079
 

I also made a .service script to make this server a systemctl service for 
linux systems that use it.
You'll find instructions in the script itself, I don't know much about 
these but it seems to be working like a charm on my vps   
https://gitlab.com/snippets/1926082

Hope you find it useful,
-- Panos






On Monday, December 30, 2019 at 5:10:22 PM UTC, Mark S. wrote:
>
> Added under saving.
>
> On Monday, December 30, 2019 at 5:01:28 AM UTC-8, Mohammad wrote:
>>
>> To David Gifford,
>>
>> Please add Python Server to Tiddlywiki toolmap! It is a single html file 
>> saver
>>
>> --Mohammad
>>
>> On Sunday, December 29, 2019 at 11:14:37 AM UTC+3:30, Mohammad wrote:
>>>
>>> Added to TW-Scripts.
>>>
>>>
>>> https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python
>>>
>>>
>>> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:

 I will describe my use case on Linux, Windows should work in a similar 
 fashion.

 My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
 placed the script as twserver.py.
 For a first test, I started it manually in a terminal window:

 /usr/bin/python3 ~/TW/twserver.py
>

 Then I pointed my browser to http://localhost:8080/. Status messages 
 started appearing in the terminal window.

 In the browser window a list of files and directories below ~/TW 
 appeared.

 I opened one of my TW files, notes.html, and created a new Tiddler. The 
 I saved the changes.
 This
 1) backed up ~/TW/notes.html html to 
 ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
 fly.
 2) saved the changes to ~/TW/notes.html.

 Now I have to find out how / where I can add a call to the script to my 
 startup or login procedures.

 HTH UBi




-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/53b42907-9485-4d08-9b70-56c959397a2d%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread 'Mark S.' via TiddlyWiki
Added under saving.

On Monday, December 30, 2019 at 5:01:28 AM UTC-8, Mohammad wrote:
>
> To David Gifford,
>
> Please add Python Server to Tiddlywiki toolmap! It is a single html file 
> saver
>
> --Mohammad
>
> On Sunday, December 29, 2019 at 11:14:37 AM UTC+3:30, Mohammad wrote:
>>
>> Added to TW-Scripts.
>>
>> https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python
>>
>>
>> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>>>
>>> I will describe my use case on Linux, Windows should work in a similar 
>>> fashion.
>>>
>>> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
>>> placed the script as twserver.py.
>>> For a first test, I started it manually in a terminal window:
>>>
>>> /usr/bin/python3 ~/TW/twserver.py

>>>
>>> Then I pointed my browser to http://localhost:8080/. Status messages 
>>> started appearing in the terminal window.
>>>
>>> In the browser window a list of files and directories below ~/TW 
>>> appeared.
>>>
>>> I opened one of my TW files, notes.html, and created a new Tiddler. The 
>>> I saved the changes.
>>> This
>>> 1) backed up ~/TW/notes.html html to 
>>> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
>>> fly.
>>> 2) saved the changes to ~/TW/notes.html.
>>>
>>> Now I have to find out how / where I can add a call to the script to my 
>>> startup or login procedures.
>>>
>>> HTH UBi
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/efb0d0a2-945e-4f63-87a1-52e7bbb27e2b%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread Mohammad
Hi Tony!
 Python is now available through MS stote

https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/

So, Microsoft Windows 10 has features to get Python installed very easily!

If you are familiar with Python then you absolutely knows better than MS 
which version fits your case!

--Mohammad


On Monday, December 30, 2019 at 2:07:29 AM UTC+3:30, TonyM wrote:
>
> Folks
>
> Can we include a simple overview for people not familiar with python and 
> its environment? I presume you can get it for multiple os implementations 
> and make use of it on most platforms. Does it have defaults that may clash 
> with other local hosts or specific ports etc... Basicaly we need to provide 
> the information people need to select it without first installing it.
>
> Regards
> Tony
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4d04dc22-1681-4147-9a49-c9a4ebfd96fa%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread Mohammad
To David Gifford,

Please add Python Server to Tiddlywiki toolmap! It is a single html file 
saver

--Mohammad

On Sunday, December 29, 2019 at 11:14:37 AM UTC+3:30, Mohammad wrote:
>
> Added to TW-Scripts.
>
> https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python
>
>
> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>>
>> I will describe my use case on Linux, Windows should work in a similar 
>> fashion.
>>
>> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
>> placed the script as twserver.py.
>> For a first test, I started it manually in a terminal window:
>>
>> /usr/bin/python3 ~/TW/twserver.py
>>>
>>
>> Then I pointed my browser to http://localhost:8080/. Status messages 
>> started appearing in the terminal window.
>>
>> In the browser window a list of files and directories below ~/TW appeared.
>>
>> I opened one of my TW files, notes.html, and created a new Tiddler. The I 
>> saved the changes.
>> This
>> 1) backed up ~/TW/notes.html html to 
>> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
>> fly.
>> 2) saved the changes to ~/TW/notes.html.
>>
>> Now I have to find out how / where I can add a call to the script to my 
>> startup or login procedures.
>>
>> HTH UBi
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/90c001bb-b4eb-492c-a5cd-1642427efb65%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-30 Thread UBi
Do you mean somthing like this?

* Python is a widely used multi purpose programming/scripting language 
available for free.
* Linux: on most Linux distributions Python is pre-installed or can be 
added easily with the distribution specific package manager.
* Windows: download it from https://www.python.org and install it. You can 
safely accept the default install options. It eats up some of your disk 
space, adds new entries to your start menu, but has no impact otherwise. 
Except that you now can create and/or run Python programs, twserver.py for 
example.

UBi

Am Sonntag, 29. Dezember 2019 23:37:29 UTC+1 schrieb TonyM:
>
> Folks
>
> Can we include a simple overview for people not familiar with python and 
> its environment? I presume you can get it for multiple os implementations 
> and make use of it on most platforms. Does it have defaults that may clash 
> with other local hosts or specific ports etc... Basicaly we need to provide 
> the information people need to select it without first installing it.
>
> Regards
> Tony
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0d335c22-dc37-4097-90b4-81865327dcd6%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-29 Thread TonyM
Folks

Can we include a simple overview for people not familiar with python and its 
environment? I presume you can get it for multiple os implementations and make 
use of it on most platforms. Does it have defaults that may clash with other 
local hosts or specific ports etc... Basicaly we need to provide the 
information people need to select it without first installing it.

Regards
Tony

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1b3b7d2b-2385-4135-86d0-5f7280a6bc83%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-29 Thread Mohammad
Good improvements
Thanks for the update!

--Mohammad



On Sunday, December 29, 2019 at 9:45:16 PM UTC+3:30, UBi wrote:
>
> Hi again,
>
> here is a slightly improved version of twserver.py (moved timestamp before 
> .html in backup file names, tidied code).
>
> #!/usr/bin/python3
>
> import datetime, shutil, os, http.server
>
> def makebackup(src):
> (srcpath, srcfile) = os.path.split(src)
> (srcname, src_ext) = os.path.splitext(srcfile)
> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
> dstpath = os.path.join(srcpath,'twBackups')
> if not os.path.exists(dstpath):
> os.mkdir(dstpath)
> shutil.copyfile(src, os.path.join(dstpath, srcname+'-'+tstamp+src_ext
> ))
>
> class ExtendedHandler(http.server.SimpleHTTPRequestHandler):
> def do_OPTIONS(self):
> self.send_response(200, 'OK')
> self.send_header('allow',
> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
> self.send_header('x-api-access-type','file')
> self.send_header('dav','tw5/put')
> self.end_headers()
> def do_PUT(self):
> path = self.translate_path(self.path)
> makebackup(path)
> with open(path, "wb") as dst:
> dst.write(self.rfile.read(int(self.headers['Content-Length'
> ])))
> self.send_response(200, 'OK')
> self.end_headers()
>
> os.chdir(os.path.dirname(os.path.abspath(__file__)))
> http.server.HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>
> Like it's template, 
> https://tiddlywiki.com/#Saving%20via%20a%20Minimal%20Ruby%20Server, it 
> covers only the bare minimum TW server needs.
> Feel free to use it / customise it at will.
>
> Am Samstag, 28. Dezember 2019 17:52:43 UTC+1 schrieb UBi:
>>
>> Hello,
>>
>> I had some spare time recently, so I tried to re-implement the Ruby 
>> Server in Python:
>>
>> #!/usr/bin/python3
>>
>> from http.server import SimpleHTTPRequestHandler, HTTPServer
>> import datetime, shutil, os
>>
>> def makebackup(src):
>> (srcpath, srcfile) = os.path.split(src)
>> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
>> dstpath = os.path.join(srcpath,'twBackups')
>> if not os.path.exists(dstpath):
>> os.mkdir(dstpath)
>> shutil.copyfile(src, os.path.join(dstpath, srcfile+'.'+tstamp))
>>
>> class ExtendedHandler(SimpleHTTPRequestHandler):
>> def do_OPTIONS(self):
>> self.send_response(200, 'OK')
>> self.send_header('allow',
>> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
>> self.send_header('x-api-access-type','file')
>> self.send_header('dav','tw5/put')
>> self.end_headers()
>> def do_PUT(self):
>> length = int(self.headers['Content-Length'])
>> path = self.translate_path(self.path)
>> makebackup(path)
>> with open(path, "wb") as dst:
>> dst.write(self.rfile.read(length))
>> self.send_response(200, 'OK')
>> self.send_header('Content-Type', 'text/html')
>> self.end_headers()
>>
>> os.chdir(os.path.dirname(os.path.abspath(__file__)))
>> HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>>
>> It works for me :-)
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0bfc370f-e45b-4acc-a286-f3446dcb35a0%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-29 Thread UBi
Hi again,

here is a slightly improved version of twserver.py (moved timestamp before 
.html in backup file names, tidied code).

#!/usr/bin/python3

import datetime, shutil, os, http.server

def makebackup(src):
(srcpath, srcfile) = os.path.split(src)
(srcname, src_ext) = os.path.splitext(srcfile)
tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
dstpath = os.path.join(srcpath,'twBackups')
if not os.path.exists(dstpath):
os.mkdir(dstpath)
shutil.copyfile(src, os.path.join(dstpath, srcname+'-'+tstamp+src_ext))

class ExtendedHandler(http.server.SimpleHTTPRequestHandler):
def do_OPTIONS(self):
self.send_response(200, 'OK')
self.send_header('allow','GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav'
)
self.send_header('x-api-access-type','file')
self.send_header('dav','tw5/put')
self.end_headers()
def do_PUT(self):
path = self.translate_path(self.path)
makebackup(path)
with open(path, "wb") as dst:
dst.write(self.rfile.read(int(self.headers['Content-Length'])))
self.send_response(200, 'OK')
self.end_headers()

os.chdir(os.path.dirname(os.path.abspath(__file__)))
http.server.HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()

Like it's template, 
https://tiddlywiki.com/#Saving%20via%20a%20Minimal%20Ruby%20Server, it 
covers only the bare minimum TW server needs.
Feel free to use it / customise it at will.

Am Samstag, 28. Dezember 2019 17:52:43 UTC+1 schrieb UBi:
>
> Hello,
>
> I had some spare time recently, so I tried to re-implement the Ruby Server 
> in Python:
>
> #!/usr/bin/python3
>
> from http.server import SimpleHTTPRequestHandler, HTTPServer
> import datetime, shutil, os
>
> def makebackup(src):
> (srcpath, srcfile) = os.path.split(src)
> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
> dstpath = os.path.join(srcpath,'twBackups')
> if not os.path.exists(dstpath):
> os.mkdir(dstpath)
> shutil.copyfile(src, os.path.join(dstpath, srcfile+'.'+tstamp))
>
> class ExtendedHandler(SimpleHTTPRequestHandler):
> def do_OPTIONS(self):
> self.send_response(200, 'OK')
> self.send_header('allow',
> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
> self.send_header('x-api-access-type','file')
> self.send_header('dav','tw5/put')
> self.end_headers()
> def do_PUT(self):
> length = int(self.headers['Content-Length'])
> path = self.translate_path(self.path)
> makebackup(path)
> with open(path, "wb") as dst:
> dst.write(self.rfile.read(length))
> self.send_response(200, 'OK')
> self.send_header('Content-Type', 'text/html')
> self.end_headers()
>
> os.chdir(os.path.dirname(os.path.abspath(__file__)))
> HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>
> It works for me :-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/80ca81b0-61b1-46c0-b35f-b6e15dfa8d69%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-29 Thread Mohammad
Hi UBi
 Many thanks for your clarification!
Python Server worth to be added to Tiddlywiki.com tiddler on saving and 
working with Tiddlywiki.
Cheers
Mohammad

On Sunday, December 29, 2019 at 3:32:18 PM UTC+3:30, UBi wrote:
>
> Argl. According to https://en.wikipedia.org/wiki/HTTP_404, 404 means "Not 
> found".
> Thus we could read the yellow lines as
>
> code: 404, message "File not found"
>
> This fits the missing favicon.ico situation.
>
> Am Sonntag, 29. Dezember 2019 12:16:38 UTC+1 schrieb UBi:
>>
>> Hi Mohammad,
>>
>> as you can see on the line following the yellow lines, your browser 
>> automatically tries to fetch a favicon.ico file.
>> If there is none, the server sends a 404 error code, usually accompanied 
>> by a short description.
>> It seems that in this case resolving the code to a description went wrong.
>> I can't tell you why, I'm not that familiar with the 
>> SimpleHTTPRequestHandler innards.
>>
>> Am Sonntag, 29. Dezember 2019 08:10:02 UTC+1 schrieb Mohammad:
>>>
>>> The script works fine, I am just curious about the message 404 appears 
>>> on terminal window. I have highlighted them.
>>>
>>> Mohammad@6600K C:\TW\201. Python server  
>>>  
>>> $ python server.py  
>>>   
>>> 127.0.0.1 - - [29/Dec/2019 09:14:54] "GET / HTTP/1.1" 200 -  
>>>  
>>> 127.0.0.1 - - [29/Dec/2019 09:14:54] code 404, message File not found
>>>  
>>> 127.0.0.1 - - [29/Dec/2019 09:14:54] "GET /favicon.ico HTTP/1.1" 404 -  
>>>   
>>> 127.0.0.1 - - [29/Dec/2019 09:15:37] "GET /wikis/ HTTP/1.1" 200 -
>>>  
>>> 127.0.0.1 - - [29/Dec/2019 09:15:40] "GET /wikis/tw.html HTTP/1.1" 200 
>>> -  
>>> 127.0.0.1 - - [29/Dec/2019 09:15:41] "OPTIONS /wikis/tw.html HTTP/1.1" 
>>> 200 -  
>>> 127.0.0.1 - - [29/Dec/2019 09:15:42] code 404, message File not found  
>>>
>>> 127.0.0.1 - - [29/Dec/2019 09:15:42] "GET /wikis/favicon.ico HTTP/1.1" 
>>> 404 -  
>>> 127.0.0.1 - - [29/Dec/2019 09:16:16] "PUT /wikis/tw.html HTTP/1.1" 200 
>>> -  
>>> 127.0.0.1 - - [29/Dec/2019 09:16:16] "HEAD /wikis/tw.html HTTP/1.1" 200 
>>> - 
>>> 127.0.0.1 - - [29/Dec/2019 09:41:05] "GET / HTTP/1.1" 200 -  
>>>  
>>> 127.0.0.1 - - [29/Dec/2019 09:41:06] code 404, message File not found
>>>  
>>> 127.0.0.1 - - [29/Dec/2019 09:41:06] "GET /favicon.ico HTTP/1.1" 404 -  
>>>   
>>>
>>>
>>>
>>> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:

 I will describe my use case on Linux, Windows should work in a similar 
 fashion.

 My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
 placed the script as twserver.py.
 For a first test, I started it manually in a terminal window:

 /usr/bin/python3 ~/TW/twserver.py
>

 Then I pointed my browser to http://localhost:8080/. Status messages 
 started appearing in the terminal window.

 In the browser window a list of files and directories below ~/TW 
 appeared.

 I opened one of my TW files, notes.html, and created a new Tiddler. The 
 I saved the changes.
 This
 1) backed up ~/TW/notes.html html to 
 ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
 fly.
 2) saved the changes to ~/TW/notes.html.

 Now I have to find out how / where I can add a call to the script to my 
 startup or login procedures.

 HTH UBi




-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/05cd6d0d-8c62-4826-a3c0-795bf2288ca9%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-29 Thread UBi
Argl. According to https://en.wikipedia.org/wiki/HTTP_404, 404 means "Not 
found".
Thus we could read the yellow lines as

code: 404, message "File not found"

This fits the missing favicon.ico situation.

Am Sonntag, 29. Dezember 2019 12:16:38 UTC+1 schrieb UBi:
>
> Hi Mohammad,
>
> as you can see on the line following the yellow lines, your browser 
> automatically tries to fetch a favicon.ico file.
> If there is none, the server sends a 404 error code, usually accompanied 
> by a short description.
> It seems that in this case resolving the code to a description went wrong.
> I can't tell you why, I'm not that familiar with the 
> SimpleHTTPRequestHandler innards.
>
> Am Sonntag, 29. Dezember 2019 08:10:02 UTC+1 schrieb Mohammad:
>>
>> The script works fine, I am just curious about the message 404 appears on 
>> terminal window. I have highlighted them.
>>
>> Mohammad@6600K C:\TW\201. Python server  
>>  
>> $ python server.py
>> 
>> 127.0.0.1 - - [29/Dec/2019 09:14:54] "GET / HTTP/1.1" 200 -  
>>  
>> 127.0.0.1 - - [29/Dec/2019 09:14:54] code 404, message File not found
>>  
>> 127.0.0.1 - - [29/Dec/2019 09:14:54] "GET /favicon.ico HTTP/1.1" 404 -
>> 
>> 127.0.0.1 - - [29/Dec/2019 09:15:37] "GET /wikis/ HTTP/1.1" 200 -
>>  
>> 127.0.0.1 - - [29/Dec/2019 09:15:40] "GET /wikis/tw.html HTTP/1.1" 200 -  
>> 
>> 127.0.0.1 - - [29/Dec/2019 09:15:41] "OPTIONS /wikis/tw.html HTTP/1.1" 
>> 200 -  
>> 127.0.0.1 - - [29/Dec/2019 09:15:42] code 404, message File not found  
>>
>> 127.0.0.1 - - [29/Dec/2019 09:15:42] "GET /wikis/favicon.ico HTTP/1.1" 
>> 404 -  
>> 127.0.0.1 - - [29/Dec/2019 09:16:16] "PUT /wikis/tw.html HTTP/1.1" 200 -  
>> 
>> 127.0.0.1 - - [29/Dec/2019 09:16:16] "HEAD /wikis/tw.html HTTP/1.1" 200 
>> - 
>> 127.0.0.1 - - [29/Dec/2019 09:41:05] "GET / HTTP/1.1" 200 -  
>>  
>> 127.0.0.1 - - [29/Dec/2019 09:41:06] code 404, message File not found
>>  
>> 127.0.0.1 - - [29/Dec/2019 09:41:06] "GET /favicon.ico HTTP/1.1" 404 -
>> 
>>
>>
>>
>> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>>>
>>> I will describe my use case on Linux, Windows should work in a similar 
>>> fashion.
>>>
>>> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
>>> placed the script as twserver.py.
>>> For a first test, I started it manually in a terminal window:
>>>
>>> /usr/bin/python3 ~/TW/twserver.py

>>>
>>> Then I pointed my browser to http://localhost:8080/. Status messages 
>>> started appearing in the terminal window.
>>>
>>> In the browser window a list of files and directories below ~/TW 
>>> appeared.
>>>
>>> I opened one of my TW files, notes.html, and created a new Tiddler. The 
>>> I saved the changes.
>>> This
>>> 1) backed up ~/TW/notes.html html to 
>>> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
>>> fly.
>>> 2) saved the changes to ~/TW/notes.html.
>>>
>>> Now I have to find out how / where I can add a call to the script to my 
>>> startup or login procedures.
>>>
>>> HTH UBi
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/cb7b65a8-2d5a-4187-bc98-31de83a44563%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-29 Thread UBi
Hi Mohammad,

as you can see on the line following the yellow lines, your browser 
automatically tries to fetch a favicon.ico file.
If there is none, the server sends a 404 error code, usually accompanied by 
a short description.
It seems that in this case resolving the code to a description went wrong.
I can't tell you why, I'm not that familiar with the 
SimpleHTTPRequestHandler innards.

Am Sonntag, 29. Dezember 2019 08:10:02 UTC+1 schrieb Mohammad:
>
> The script works fine, I am just curious about the message 404 appears on 
> terminal window. I have highlighted them.
>
> Mohammad@6600K C:\TW\201. Python server
>
> $ python server.py
> 
> 127.0.0.1 - - [29/Dec/2019 09:14:54] "GET / HTTP/1.1" 200 -
>
> 127.0.0.1 - - [29/Dec/2019 09:14:54] code 404, message File not found
>  
> 127.0.0.1 - - [29/Dec/2019 09:14:54] "GET /favicon.ico HTTP/1.1" 404 -
> 
> 127.0.0.1 - - [29/Dec/2019 09:15:37] "GET /wikis/ HTTP/1.1" 200 -  
>
> 127.0.0.1 - - [29/Dec/2019 09:15:40] "GET /wikis/tw.html HTTP/1.1" 200 -  
> 
> 127.0.0.1 - - [29/Dec/2019 09:15:41] "OPTIONS /wikis/tw.html HTTP/1.1" 200 
> -  
> 127.0.0.1 - - [29/Dec/2019 09:15:42] code 404, message File not found  
>
> 127.0.0.1 - - [29/Dec/2019 09:15:42] "GET /wikis/favicon.ico HTTP/1.1" 404 
> -  
> 127.0.0.1 - - [29/Dec/2019 09:16:16] "PUT /wikis/tw.html HTTP/1.1" 200 -  
> 
> 127.0.0.1 - - [29/Dec/2019 09:16:16] "HEAD /wikis/tw.html HTTP/1.1" 200 -  
>
> 127.0.0.1 - - [29/Dec/2019 09:41:05] "GET / HTTP/1.1" 200 -
>
> 127.0.0.1 - - [29/Dec/2019 09:41:06] code 404, message File not found
>  
> 127.0.0.1 - - [29/Dec/2019 09:41:06] "GET /favicon.ico HTTP/1.1" 404 -
> 
>
>
>
> On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>>
>> I will describe my use case on Linux, Windows should work in a similar 
>> fashion.
>>
>> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I 
>> placed the script as twserver.py.
>> For a first test, I started it manually in a terminal window:
>>
>> /usr/bin/python3 ~/TW/twserver.py
>>>
>>
>> Then I pointed my browser to http://localhost:8080/. Status messages 
>> started appearing in the terminal window.
>>
>> In the browser window a list of files and directories below ~/TW appeared.
>>
>> I opened one of my TW files, notes.html, and created a new Tiddler. The I 
>> saved the changes.
>> This
>> 1) backed up ~/TW/notes.html html to 
>> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
>> fly.
>> 2) saved the changes to ~/TW/notes.html.
>>
>> Now I have to find out how / where I can add a call to the script to my 
>> startup or login procedures.
>>
>> HTH UBi
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0a9f0ab1-ae10-4f05-ae91-2dd854287937%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-28 Thread Mohammad
More comments:

   - add a line for terminating the code
   - on windows ctrl+C works with a not good exit message


On Saturday, December 28, 2019 at 8:22:43 PM UTC+3:30, UBi wrote:
>
> Hello,
>
> I had some spare time recently, so I tried to re-implement the Ruby Server 
> in Python:
>
> #!/usr/bin/python3
>
> from http.server import SimpleHTTPRequestHandler, HTTPServer
> import datetime, shutil, os
>
> def makebackup(src):
> (srcpath, srcfile) = os.path.split(src)
> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
> dstpath = os.path.join(srcpath,'twBackups')
> if not os.path.exists(dstpath):
> os.mkdir(dstpath)
> shutil.copyfile(src, os.path.join(dstpath, srcfile+'.'+tstamp))
>
> class ExtendedHandler(SimpleHTTPRequestHandler):
> def do_OPTIONS(self):
> self.send_response(200, 'OK')
> self.send_header('allow',
> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
> self.send_header('x-api-access-type','file')
> self.send_header('dav','tw5/put')
> self.end_headers()
> def do_PUT(self):
> length = int(self.headers['Content-Length'])
> path = self.translate_path(self.path)
> makebackup(path)
> with open(path, "wb") as dst:
> dst.write(self.rfile.read(length))
> self.send_response(200, 'OK')
> self.send_header('Content-Type', 'text/html')
> self.end_headers()
>
> os.chdir(os.path.dirname(os.path.abspath(__file__)))
> HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>
> It works for me :-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/23b7cc93-dd7f-47d3-a5e3-d9aa65da627a%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-28 Thread Mohammad
Added to TW-Scripts.

https://kookma.github.io/TW-Scripts/#Easy%20local%20saving%20with%20Python


On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>
> I will describe my use case on Linux, Windows should work in a similar 
> fashion.
>
> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I placed 
> the script as twserver.py.
> For a first test, I started it manually in a terminal window:
>
> /usr/bin/python3 ~/TW/twserver.py
>>
>
> Then I pointed my browser to http://localhost:8080/. Status messages 
> started appearing in the terminal window.
>
> In the browser window a list of files and directories below ~/TW appeared.
>
> I opened one of my TW files, notes.html, and created a new Tiddler. The I 
> saved the changes.
> This
> 1) backed up ~/TW/notes.html html to 
> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
> fly.
> 2) saved the changes to ~/TW/notes.html.
>
> Now I have to find out how / where I can add a call to the script to my 
> startup or login procedures.
>
> HTH UBi
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/59f4ea4e-4ce9-4d8d-9f91-15ac4f9b8016%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-28 Thread Mohammad
The script works fine, I am just curious about the message 404 appears on 
terminal window. I have highlighted them.

Mohammad@6600K C:\TW\201. Python server
   
$ python server.py  
  
127.0.0.1 - - [29/Dec/2019 09:14:54] "GET / HTTP/1.1" 200 -
   
127.0.0.1 - - [29/Dec/2019 09:14:54] code 404, message File not found  
   
127.0.0.1 - - [29/Dec/2019 09:14:54] "GET /favicon.ico HTTP/1.1" 404 -  
  
127.0.0.1 - - [29/Dec/2019 09:15:37] "GET /wikis/ HTTP/1.1" 200 -  
   
127.0.0.1 - - [29/Dec/2019 09:15:40] "GET /wikis/tw.html HTTP/1.1" 200 -
  
127.0.0.1 - - [29/Dec/2019 09:15:41] "OPTIONS /wikis/tw.html HTTP/1.1" 200 
-  
127.0.0.1 - - [29/Dec/2019 09:15:42] code 404, message File not found  
   
127.0.0.1 - - [29/Dec/2019 09:15:42] "GET /wikis/favicon.ico HTTP/1.1" 404 
-  
127.0.0.1 - - [29/Dec/2019 09:16:16] "PUT /wikis/tw.html HTTP/1.1" 200 -
  
127.0.0.1 - - [29/Dec/2019 09:16:16] "HEAD /wikis/tw.html HTTP/1.1" 200 -  
   
127.0.0.1 - - [29/Dec/2019 09:41:05] "GET / HTTP/1.1" 200 -
   
127.0.0.1 - - [29/Dec/2019 09:41:06] code 404, message File not found  
   
127.0.0.1 - - [29/Dec/2019 09:41:06] "GET /favicon.ico HTTP/1.1" 404 -  
  



On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>
> I will describe my use case on Linux, Windows should work in a similar 
> fashion.
>
> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I placed 
> the script as twserver.py.
> For a first test, I started it manually in a terminal window:
>
> /usr/bin/python3 ~/TW/twserver.py
>>
>
> Then I pointed my browser to http://localhost:8080/. Status messages 
> started appearing in the terminal window.
>
> In the browser window a list of files and directories below ~/TW appeared.
>
> I opened one of my TW files, notes.html, and created a new Tiddler. The I 
> saved the changes.
> This
> 1) backed up ~/TW/notes.html html to 
> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
> fly.
> 2) saved the changes to ~/TW/notes.html.
>
> Now I have to find out how / where I can add a call to the script to my 
> startup or login procedures.
>
> HTH UBi
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9c3cde88-dc86-432a-bf4c-2c146b93e2a7%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-28 Thread Mohammad
I tested on Windows 10 and Python 3.7.5 and it works like a charm!

This is really simple! We know Python is quite popular and many people use 
Python in their work! So this open new opportunities for using
Tiddlywiki with Python projects!

Some minor comments:
 1. add date stamp before .html extension
 2. let to define multi path for wikis (right now anything should be in the 
same directory or sub directories of *twserver.py*
 3. you may announce it in https://pypi.org/

Thank you again for this nifty tool.

--Mohammad

On Sunday, December 29, 2019 at 1:30:42 AM UTC+3:30, UBi wrote:
>
> I will describe my use case on Linux, Windows should work in a similar 
> fashion.
>
> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I placed 
> the script as twserver.py.
> For a first test, I started it manually in a terminal window:
>
> /usr/bin/python3 ~/TW/twserver.py
>>
>
> Then I pointed my browser to http://localhost:8080/. Status messages 
> started appearing in the terminal window.
>
> In the browser window a list of files and directories below ~/TW appeared.
>
> I opened one of my TW files, notes.html, and created a new Tiddler. The I 
> saved the changes.
> This
> 1) backed up ~/TW/notes.html html to 
> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
> fly.
> 2) saved the changes to ~/TW/notes.html.
>
> Now I have to find out how / where I can add a call to the script to my 
> startup or login procedures.
>
> HTH UBi
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8b0b5b6e-ee41-407e-ae79-7bc116e09e5c%40googlegroups.com.


Re: [tw5] Re: Easy local saving with Python

2019-12-28 Thread Les Farrell
This seems to work fine on Windows, I'm not a python programmer but adding
the line.

os.system('"C:/Program Files/Firefox Developer Edition/firefox.exe" -url
http://127.0.0.1:8080/mytiddlywiki.html')

before

HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()

Seems to starts up firefox pointing to my wiki without problem. (I'm using
the Developer Edition of firefox so your path might be different!)

Thanks UBi

On Sat, 28 Dec 2019 at 22:00, UBi  wrote:

> I will describe my use case on Linux, Windows should work in a similar
> fashion.
>
> My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I placed
> the script as twserver.py.
> For a first test, I started it manually in a terminal window:
>
> /usr/bin/python3 ~/TW/twserver.py
>>
>
> Then I pointed my browser to http://localhost:8080/. Status messages
> started appearing in the terminal window.
>
> In the browser window a list of files and directories below ~/TW appeared.
>
> I opened one of my TW files, notes.html, and created a new Tiddler. The I
> saved the changes.
> This
> 1) backed up ~/TW/notes.html html to
> ~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the
> fly.
> 2) saved the changes to ~/TW/notes.html.
>
> Now I have to find out how / where I can add a call to the script to my
> startup or login procedures.
>
> HTH UBi
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/1a748dec-a911-478e-ba49-647c0c6a4e5b%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAspfY0KkJNF-fb2Xir21ym%3D3t2B4s4cfZwLyu_zqAnDW1hVSw%40mail.gmail.com.


[tw5] Re: Easy local saving with Python

2019-12-28 Thread UBi
I will describe my use case on Linux, Windows should work in a similar 
fashion.

My TiddlyWiki files live in /home/ubi/TW, abbreviated ~/TW. There I placed 
the script as twserver.py.
For a first test, I started it manually in a terminal window:

/usr/bin/python3 ~/TW/twserver.py
>

Then I pointed my browser to http://localhost:8080/. Status messages 
started appearing in the terminal window.

In the browser window a list of files and directories below ~/TW appeared.

I opened one of my TW files, notes.html, and created a new Tiddler. The I 
saved the changes.
This
1) backed up ~/TW/notes.html html to 
~/TW/twBackups/notes.html.MMDDhhmmss, creating ~/TW/twBackups on the 
fly.
2) saved the changes to ~/TW/notes.html.

Now I have to find out how / where I can add a call to the script to my 
startup or login procedures.

HTH UBi


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1a748dec-a911-478e-ba49-647c0c6a4e5b%40googlegroups.com.


[tw5] Re: Easy local saving with Python

2019-12-28 Thread Mohammad
Hi UBI,
 Would you please add some description with one example to let us how to 
use it for saving Tiddlywiki

--Mohammad

On Saturday, December 28, 2019 at 8:22:43 PM UTC+3:30, UBi wrote:
>
> Hello,
>
> I had some spare time recently, so I tried to re-implement the Ruby Server 
> in Python:
>
> #!/usr/bin/python3
>
> from http.server import SimpleHTTPRequestHandler, HTTPServer
> import datetime, shutil, os
>
> def makebackup(src):
> (srcpath, srcfile) = os.path.split(src)
> tstamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
> dstpath = os.path.join(srcpath,'twBackups')
> if not os.path.exists(dstpath):
> os.mkdir(dstpath)
> shutil.copyfile(src, os.path.join(dstpath, srcfile+'.'+tstamp))
>
> class ExtendedHandler(SimpleHTTPRequestHandler):
> def do_OPTIONS(self):
> self.send_response(200, 'OK')
> self.send_header('allow',
> 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,DAV,dav')
> self.send_header('x-api-access-type','file')
> self.send_header('dav','tw5/put')
> self.end_headers()
> def do_PUT(self):
> length = int(self.headers['Content-Length'])
> path = self.translate_path(self.path)
> makebackup(path)
> with open(path, "wb") as dst:
> dst.write(self.rfile.read(length))
> self.send_response(200, 'OK')
> self.send_header('Content-Type', 'text/html')
> self.end_headers()
>
> os.chdir(os.path.dirname(os.path.abspath(__file__)))
> HTTPServer(('localhost',8080),ExtendedHandler).serve_forever()
>
> It works for me :-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/58903513-abeb-458c-8006-7a4896b07fdd%40googlegroups.com.