Commit 91dc5aeb authored by M3nt0r3's avatar M3nt0r3
Browse files

snc con la mia cartella di lavoro .....grazie a pycharm

parent abaa923dd393
pg.me
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="Python">
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
</value>
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="promogest.ui.AnagraficaComplessa.Anagrafica.pg2_statusbar" />
<option value="promogest.ui.AnagraficaComplessa.Anagrafica.record_delete_button" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="DependencyValidationManager">
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</component>
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectModuleManager">
<modules />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.8 (/usr/bin/python2.7)" project-jdk-type="Python SDK" />
<component name="RunManager">
<list size="0" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pg.me.iml" filepath="$PROJECT_DIR$/.idea/pg.me.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="hg4idea" />
</component>
</project>
\ No newline at end of file
Questo progetto è rivolto a sito ufficiale della demo sublima ed ai profili renting in cloud
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2014 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
import os
from werkzeug import Request, SharedDataMiddleware, ClosingIterator
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug import Local, LocalManager
from promogest import preEnv
from web_lib.webutils import url_map, jinja_env , hasModule, leggiInSessione, change_schema
hasModule("CSA")
# MI serve qui per controllare i moduli ed
# eventualmente aggiungerli al caricamento dei DAO primitivi
from inspect import *
from webEnv import *
from web_lib.session import Session
from sqlalchemy import *
from sqlalchemy.orm import *
local = Local()
local_manager = LocalManager([local])
application = local('application')
#from sqlalchemy.engine import reflection
#insp = reflection.Inspector.from_engine(Environment.engine)
#print "QUESTI SONO GLI SCHEMI", insp.get_schema_names()
#Environment.schemi_presenti = insp.get_schema_names()
class SublimaWebApp(object):
def __init__(self, path=None, schema=None):
from promogest import Environment
local.application = self
try:
if not (os.path.exists("cache")):
os.mkdir("cache")
if not (os.path.exists("session")):
os.mkdir("session")
except:
print("pazienza")
#TODO: eventuale gestione modulare successiva come nel pg
#self.importModulesFromDir(modules_dir="./promogest/pages/modules")
#Aggiungo le directory di lavoro ...
if preEnv.wsgi == False:
self.dispatch = SharedDataMiddleware(self.dispatch, {
'/tpl/': STATIC_PATH,
"/tpl/gui":path+"/gui",
"/tpl/stampa":path+"templates/"
#'/feed': STATIC_PATH_FEED,
})
def dispatch(self, environ, start_response):
""" Funzione importante per la gestione dello smistamento della request
"""
local.application = self
req = Request(environ)
local.url_adapter = adapter = url_map.bind_to_environ(environ)
from web_lib import routes
from web_lib.page import Page
try:
endpoint, values = adapter.match()
print " ENDPOINT", endpoint , values
handler = getattr(routes, endpoint)
jinja_env.globals['req'] = req
pathList = req.path.split('/')
jinja_env.globals['path'] = pathList
#print "PATHLIST", pathList, handler
response = handler(req, **values)
except NotFound, e:
response = self.not_found(req)
response.status_code = 404
except HTTPException, e:
response = e
return ClosingIterator(response(environ, start_response),
[local_manager.cleanup])
def not_found(self,req):
from web_lib.page import Page
pageData = {'file' : '/main/not_found'}
return Page(req).render(pageData)
def __call__(self, environ, start_response):
#from promogest import Environment
#Environment.engine.close()
#print " PASSI SEMéRE QIO" , environ['HTTP_HOST']
#subdomain = environ['HTTP_HOST'].split(':')[0][:-len("novo.le")].rstrip('.')
#print " SUBDOMOAIN", subdomain
#Environment.azienda = subdomain
#Environment.params["schema"] = subdomain
#Environment.params["engine"] = Environment.engine
#Environment.params["session"] = Environment.session
#Environment.params["metadata"] = Environment.meta
#Environment.fk_prefix = subdomain+"."
#Environment.session.execute("SET search_path TO {0}".format(subdomain))
return self.dispatch(environ, start_response)
[Server]
hostname = 0.0.0.0
reload = True
debug = True
smtpserver = localhost
port = 55333
cookie = sublimaweb
[Database]
user = promoadmin
password = admin
host = localhost
#host = 162.248.9.11
port = 5432
database = promogest_db
#database = pg_pt_db_test
azienda = ferchim
#azienda = promoweb
tipodb = postgresql
sqlitedb = promotux_it.sqlite
[Templates]
#Quando non è presente nessuna parte pubblica si mette "no" e si verrà rimandati in prelogin per accedere alla parte privata
#Quando cmq il campo è vuoto andrà in main semplice
main_template_dir = no
#custom_pg_template_dir =
[Modulo]
PT = False
ADR = False
CSA = False
[Server]
hostname = 0.0.0.0
reload = True
debug = True
smtpserver = localhost
port = 55333
cookie = sublimaweb
[Database]
user = promoadmin
password = admin
host = localhost
port = 5432
database = db_tutti
azienda = promotux2
tipodb = postgresql
[Templates]
#Quando non è presente nessuna parte pubblica si mette "no" e si verrà rimandati in prelogin per accedere alla parte privata
#Quando cmq il campo è vuoto andrà in main semplice
main_template_dir = promogest
#custom_pg_template_dir =
[Modulo]
PT = False
ADR = False
CSA = False
[Server]
hostname = 0.0.0.0
reload = True
debug = True
smtpserver = localhost
port = 55333
cookie = sublimaweb
[Database]
user = promoadmin
password = admin
host = localhost
#host = 162.248.9.11
port = 5432
database = promogest_db
#database = pg_pt_db_test
azienda = veterfarma
#azienda = promoweb
tipodb = postgresql
sqlitedb = promotux_it.sqlite
[Templates]
#Quando non è presente nessuna parte pubblica si mette "no" e si verrà rimandati in prelogin per accedere alla parte privata
#Quando cmq il campo è vuoto andrà in main semplice
main_template_dir = no
#custom_pg_template_dir =
[Modulo]
PT = False
ADR = False
CSA = False
[Server]
hostname = 0.0.0.0
reload = True
debug = True
smtpserver = localhost
port = 55333
cookie = sublimaweb
[Database]
user = promoadmin
password = admin
host = localhost
#host = 162.248.9.11
port = 5432
database = promogest_db
#database = pg_pt_db_test
azienda = veterfarma
#azienda = promoweb
tipodb = postgresql
sqlitedb = promotux_it.sqlite
[Templates]
#Quando non è presente nessuna parte pubblica si mette "no" e si verrà rimandati in prelogin per accedere alla parte privata
#Quando cmq il campo è vuoto andrà in main semplice
main_template_dir = no
#custom_pg_template_dir =
[Modulo]
PT = False
ADR = False
CSA = False
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2014 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
from web_lib.page import Page
from web_lib.webutils import Response, expose, addSlash, permalinkaTitle
@expose('/cms/<pages>')
@expose('/promoGest/cms/<pages>')
def staticpages(req,pages=None, subdomain=None):
""" Funzione per la visualizzazione pagine statiche
"""
from promogest.dao.StaticPages import StaticPages
staticPages = StaticPages(req=req).select(permalink=pages)
if not staticPages:
staticPages = StaticPages(req=req).select(titlePage=pages)
if staticPages:
staticPages[0].permalink = permalinkaTitle(pages)
staticPages[0].persist()
if staticPages:
staticPages = staticPages[0]
title = staticPages.title
else:
title = "Pagina non presente"
pageData = {'file' : 'main/static',
'staticPages' : staticPages,
"page_title": title,
"bodyTags":["staticPages"]}
return Page(req).render(pageData)
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
from web_lib.page import Page
from web_lib.webutils import Response, expose, addSlash, permalinkaTitle
@expose('/contact')
@expose('/contact/<pages>')
def contact(req,pages=None, subdomain=None):
""" Dettagli Articolo
"""
pageData = {'file' : 'main/contact',
}
return Page(req).render(pageData)
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2014 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
import hashlib
import datetime
from sqlalchemy.orm import *
from promogest.dao.User import User
from web_lib.webutils import *
from web_lib.session import Session
from web_lib.page import Page
@expose('/contacts')
def contacts(req, static=None, subdomain=None):
"""
funzione per la cattura dati form contatti
"""
name = req.form.get('name')
email = req.form.get('email')
body = req.form.get('body')
if name and email and body:
SendMail(req=req, subdomain=subdomain, to="me").sendContact(form=req.form)
# redirectUrl=addSlash("/")
# return Page(req).redirect(redirectUrl)
pageData = {'file' : 'ok_contact',
#"subdomain": subdomain,
'sent' : "True"}
return Page(req).render(pageData)
else:
pageData = {'file' : 'main/contact',
'sent' : "False"}
return Page(req).render(pageData)
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2014 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
import datetime
try:
from collections import OrderedDict
except:
from ordereddict import OrderedDict
from promogest.lib.utils import *
from web_lib.page import Page
from web_lib.webutils import Response, expose
from web_lib.session import Session
import simplejson as json
@expose('/eshop')
def eshop(req, dao=None, action=None):
"""
versione alpha di un ordine da cliente
Funzione generale, le altre sono sotto funzioni di questa
Al momento sono due, una visualizza l'elenco degli articoli con prezzi e descrizioni
l'altra si occupa dell'ordine e del resto
tutto è gestito dalla action. presa come argomento del form
"""
from promogest.dao.DaoUtils import numeroRegistroGet
from promogest.dao.Articolo import Articolo
from promogest.dao.Listino import Listino
from promogest.dao.Cliente import Cliente
from promogest.dao.Fornitore import Fornitore
from promogest.dao.Vettore import Vettore
from promogest.dao.CategoriaArticolo import CategoriaArticolo
from promogest.dao.Fornitura import Fornitura
from promogest.dao.AliquotaIva import AliquotaIva
from promogest.dao.Multiplo import Multiplo
from promogest.dao.TestataDocumento import TestataDocumento
from promogest.dao.RigaDocumento import RigaDocumento
from promogest.dao.ScontoTestataDocumento import ScontoTestataDocumento
from promogest.dao.Cart import Cart
#pricelist = Listino().select(id=setconf("VenditaDettaglio", "listino_vendita"))
#categorie = CategoriaArticolo().select(batchSize=None, orderBy="id")
#daoCliente = Cliente().getRecord(id=req.form.get("id_cliente"))
action = req.form.get("action")
print " ACTION", action
def __impiantoOrdine(req, dao=None, action=None, done=False):
diz = OrderedDict()
righe_ordine = OrderedDict()
id_cliente = req.form.get("id_cliente") or None
id_user = None
daoCliente = None
if not id_cliente:
id_user = Session(req).getUserId()
print " ID USSSSSSSSSSSSSSSSSSSSSSSSSSSER", id_user
if id_user:
daoClientes = Cliente().select(idUser=id_user)
if daoClientes:
daoCliente= daoClientes[0]
id_cliente = daoCliente.id
else:
daoCliente = Cliente().getRecord(id=id_cliente)
print " MA PASSO QIO VERP", daoCliente
prezzi = OrderedDict()
pricelist = Listino().select(id=setconf("VenditaDettaglio", "listino_vendita"))
categorie = CategoriaArticolo().select(batchSize=None, orderBy="id")
for c in categorie:
art = Articolo().select(idCategoria=c.id,
orderBy=Articolo.denominazione, idStato=1,
cancellato=True, batchSize=None)
for a in art:
if pricelist:
#prezzi[a.id] = leggiListino(pricelist[0].id, a.id, tiny=True)["prezzoDettaglio"]
prezzi[a.id] = leggiListino("10", a.id, tiny=True)["prezzoIngrosso"]
else:
prezzi[a.id] = 0
diz[c] = art
rc = OrderedDict()
trash = req.args.get("trash")
righe_cart = []
print " ID CLIENTEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", id_cliente
if id_cliente:
righe_cart = Cart().select(idCliente=id_cliente, batchSize=None)
if not righe_cart:
righe_cart = Cart().select(sessionid=req.cookies["promogest_web"], batchSize=None)
for r in righe_cart:
r.id_cliente = id_cliente
r.id_utente = id_user
r.sessionid = None
r.persist()
else:
righe_cart = Cart().select(sessionid=req.cookies["promogest_web"], batchSize=None)
print "RIGHE CAAAAAAAAAAAAAAAAAAAARTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", righe_cart
if righe_cart:
for r in righe_cart:
if trash == "true":
r.delete()
else: